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"
|
2022-10-13 22:11:02 +02:00
|
|
|
UserWebDAVUsage = "allow to sync files via WebDAV"
|
2022-09-28 09:01:17 +02:00
|
|
|
)
|
2022-09-02 21:30:50 +02:00
|
|
|
|
2023-02-14 11:37:22 +01:00
|
|
|
// UsersCommand configures the user management subcommands.
|
2021-08-20 00:10:26 +02:00
|
|
|
var UsersCommand = cli.Command{
|
2022-10-03 22:59:29 +02:00
|
|
|
Name: "users",
|
|
|
|
Aliases: []string{"user"},
|
|
|
|
Usage: "User management subcommands",
|
2021-08-18 20:19:14 +02:00
|
|
|
Subcommands: []cli.Command{
|
2022-09-28 09:01:17 +02:00
|
|
|
UsersListCommand,
|
2022-10-13 22:11:02 +02:00
|
|
|
UsersLegacyCommand,
|
2022-09-28 09:01:17 +02:00
|
|
|
UsersAddCommand,
|
|
|
|
UsersShowCommand,
|
|
|
|
UsersModCommand,
|
|
|
|
UsersRemoveCommand,
|
2022-10-08 20:48:58 +02:00
|
|
|
UsersResetCommand,
|
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{
|
2022-10-13 22:11:02 +02:00
|
|
|
Name: "webdav, w",
|
|
|
|
Usage: UserWebDAVUsage,
|
2022-09-28 09:01:17 +02:00
|
|
|
},
|
2021-08-18 20:19:14 +02:00
|
|
|
}
|