feat:完善项目信息

This commit is contained in:
henry
2022-01-07 16:12:43 +08:00
parent 657fdc5750
commit 2bf3c01702
21 changed files with 379 additions and 129 deletions

View File

@ -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")
}