2021-08-18 20:19:14 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2021-09-22 19:33:41 +02:00
|
|
|
"github.com/urfave/cli"
|
|
|
|
|
2022-09-28 09:01:17 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/acl"
|
2021-08-18 20:19:14 +02:00
|
|
|
)
|
|
|
|
|
2022-09-28 09:01:17 +02:00
|
|
|
// Usage hints for the user management subcommands.
|
|
|
|
const (
|
2022-09-30 00:42:19 +02:00
|
|
|
UserNameUsage = "full `NAME` for display in the interface"
|
|
|
|
UserEmailUsage = "unique `EMAIL` address of the user"
|
|
|
|
UserPasswordUsage = "`PASSWORD` for authentication"
|
|
|
|
UserRoleUsage = "user account `ROLE`"
|
|
|
|
UserAttrUsage = "custom user account `ATTRIBUTES`"
|
|
|
|
UserAdminUsage = "make user super admin with full access"
|
|
|
|
UserNoLoginUsage = "disable login on the web interface"
|
|
|
|
UserCanSyncUsage = "allow to sync files via WebDAV"
|
2022-09-28 09:01:17 +02:00
|
|
|
)
|
2022-09-02 21:30:50 +02:00
|
|
|
|
2022-09-28 09:01:17 +02:00
|
|
|
// UsersCommand registers the user management subcommands.
|
2021-08-20 00:10:26 +02:00
|
|
|
var UsersCommand = cli.Command{
|
2021-08-18 20:19:14 +02:00
|
|
|
Name: "users",
|
2021-10-06 08:31:35 +02:00
|
|
|
Usage: "User management subcommands",
|
2021-08-18 20:19:14 +02:00
|
|
|
Subcommands: []cli.Command{
|
2022-09-28 09:01:17 +02:00
|
|
|
UsersListCommand,
|
|
|
|
UsersAddCommand,
|
|
|
|
UsersShowCommand,
|
|
|
|
UsersModCommand,
|
|
|
|
UsersRemoveCommand,
|
2021-08-18 20:19:14 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-09-28 09:01:17 +02:00
|
|
|
// UserFlags specifies the add and modify user command flags.
|
|
|
|
var UserFlags = []cli.Flag{
|
|
|
|
cli.StringFlag{
|
2022-09-30 00:42:19 +02:00
|
|
|
Name: "name, n",
|
|
|
|
Usage: UserNameUsage,
|
2022-09-28 09:01:17 +02:00
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "email, m",
|
|
|
|
Usage: UserEmailUsage,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "password, p",
|
|
|
|
Usage: UserPasswordUsage,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "role, r",
|
|
|
|
Usage: UserRoleUsage,
|
|
|
|
Value: acl.RoleAdmin.String(),
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "attr, a",
|
|
|
|
Usage: UserAttrUsage,
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "superadmin, s",
|
|
|
|
Usage: UserAdminUsage,
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
2022-09-30 00:42:19 +02:00
|
|
|
Name: "no-login, l",
|
|
|
|
Usage: UserNoLoginUsage,
|
2022-09-28 09:01:17 +02:00
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "can-sync, w",
|
|
|
|
Usage: UserCanSyncUsage,
|
|
|
|
},
|
2021-08-18 20:19:14 +02:00
|
|
|
}
|