refactor: spell the five permission codes out in the catalog
The catalog reads like the Winter registerPermissions() list, and a test pins the codes and their default roles.
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"git.golem15.com/golem15/sm-user-plugin/classes"
|
||||
"git.golem15.com/golem15/sm-user-plugin/controllers"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
)
|
||||
import "git.golem15.com/golem15/summercms/modules/pact"
|
||||
|
||||
const userPermissionTab = "golem15.user::lang.plugin.tab"
|
||||
|
||||
// Permissions is the plugin's Winter registerPermissions() catalog plus one
|
||||
// code of its own. The four PHP codes default to the developer role;
|
||||
// impersonate_user is registered so imported backend roles that name it stay
|
||||
// valid, although no screen uses it. manage_privileged_groups has no default
|
||||
// role: only a superuser, or a role that was granted it explicitly, may
|
||||
// change the email or password of a privileged-group member or delete one.
|
||||
// valid, although no screen uses it. The fifth code
|
||||
// (classes.PermissionManagePrivilegedGroups) has no default role: only a
|
||||
// superuser, or a role that was granted it explicitly, may change the email
|
||||
// or password of a privileged-group member or delete one.
|
||||
func (*Plugin) Permissions() []pact.Permission {
|
||||
return []pact.Permission{
|
||||
{
|
||||
Code: controllers.PermissionAccessUsers,
|
||||
Code: "golem15.users.access_users",
|
||||
Tab: userPermissionTab,
|
||||
Label: "golem15.user::lang.plugin.access_users",
|
||||
Roles: []string{"developer"},
|
||||
@@ -41,7 +38,7 @@ func (*Plugin) Permissions() []pact.Permission {
|
||||
Roles: []string{"developer"},
|
||||
},
|
||||
{
|
||||
Code: classes.PermissionManagePrivilegedGroups,
|
||||
Code: "golem15.users.manage_privileged_groups",
|
||||
Tab: userPermissionTab,
|
||||
Label: "golem15.user::lang.plugin.manage_privileged_groups",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user