场景1:所有的资源权限被设置为管理角色
步骤1:获取当前的管理角色详细信息
SELECT * FROM admin_role WHERE role_name = 'Administrators'
/*Administrators - is Your admin role name*/
步骤2:删除管理角色的现有权限
/*clean all permission rules*/
DELETE admin_rule
FROM admin_rule, admin_role
WHERE
admin_role.role_name = 'Administrators' /* Your admin role name*/
AND admin_rule.role_id = admin_role.role_id
步骤3:更新管理角色的权限规则
INSERT INTO admin_rule (role_id, resource_id, assert_id, role_type, permission)
VALUES ('1','all', '0', 'G', 'allow')
方案2:管理是一个不好的作用assignd
步骤1:加载用户信息
SELECT ar.*, au.*
FROM admin_user AS au
INNER JOIN admin_role AS ar ON (au.user_id = ar.user_id)
WHERE au.username = 'username'
步骤2:负载角色信息
SELECT * FROM admin_role WHERE role_type = 'G'
步骤3:更新你的用户以适当的角色
UPDATE admin_role SET parent_id = [put selected role_id here] WHERE user_id = [your USER id]
(责任编辑:最模板) |