0
我有一个超过20个角色和权限的相当大的网站。然而,它始终是相同的权限,但取决于谁创建的内容,权限不同...配置具有相同权限的多个角色
所以我现在做的是这样的:
// Make the new role
$role = new stdClass;
$role->name = 'Redacteur 1';
$role->weight = 3;
user_role_save($role);
// Permissions to assign to the role.
// Note these are defined in hook_permission()
$perms = array(
'access content','access content overview'
);
// Grant the permissions. This function takes care of all necessary cache resets
user_role_grant_permissions($role->rid, $perms);
// Make the new role
$role = new stdClass;
$role->name = 'Redacteur 2';
$role->weight = 3;
user_role_save($role);
// Permissions to assign to the role.
// Note these are defined in hook_permission()
$perms = array(
'access content','access content overview'
);
// Grant the permissions. This function takes care of all necessary cache resets
user_role_grant_permissions($role->rid, $perms);
难道没有办法做这与某种阵列,所以我不会结束1000行代码。当你想改变某些权限时,你必须修改所有角色......这样做一定比较容易。有什么建议?