feat:完善项目信息
This commit is contained in:
@ -168,8 +168,28 @@ func (this *Permission) AddPolicies() (bool, error) {
|
||||
return auth.enforcer.AddPolicies(rules)
|
||||
}
|
||||
|
||||
// RemoveRolePolicy 删除角色的所有规则
|
||||
func (this *Permission) RemoveRolePolicy() (bool, error) {
|
||||
// RemoveRolePolicies 删除角色指定规则
|
||||
func (this *Permission) RemoveRolePolicies() (bool, error) {
|
||||
if len(this.roles) <= 0 {
|
||||
return false, errors.New("not role")
|
||||
}
|
||||
rules := make([][]string, 0)
|
||||
|
||||
tenantFormat := this.tenantFormat()
|
||||
|
||||
for _, v := range this.roleFormat() {
|
||||
|
||||
for _, request := range this.request {
|
||||
rules = append(rules, []string{
|
||||
v, tenantFormat, request.Url, request.Method,
|
||||
})
|
||||
}
|
||||
}
|
||||
return auth.enforcer.RemovePolicies(rules)
|
||||
}
|
||||
|
||||
// RemoveSingleRolePolicy 删除角色的所有规则
|
||||
func (this *Permission) RemoveSingleRolePolicy() (bool, error) {
|
||||
if len(this.roles) <= 0 {
|
||||
return false, errors.New("not role")
|
||||
}
|
||||
|
Reference in New Issue
Block a user