Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bwallet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Go
bwallet
Commits
be2ed024
Commit
be2ed024
authored
May 10, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove group
parent
5572fbce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
casbin_rule.go
models/casbin_rule.go
+4
-4
casbin_rule.go
service/casbin_service/casbin_rule.go
+2
-2
No files found.
models/casbin_rule.go
View file @
be2ed024
...
...
@@ -21,12 +21,12 @@ func AddGroupingPolicy(params map[string]interface{}) error {
return
nil
}
func
RemovePolicy
(
params
...
interface
{})
error
{
return
nil
func
RemoveGroupingPolicy
(
ptype
string
,
fieldIndex
int
,
fieldValues
string
)
bool
{
success
,
_
:=
rbac
.
Ef
.
RemoveFilteredNamedGroupingPolicy
(
ptype
,
fieldIndex
,
fieldValues
)
return
success
}
func
ClearCasbin
(
ptype
string
,
fieldIndex
int
,
fieldValues
string
)
bool
{
func
RemovePolicy
(
ptype
string
,
fieldIndex
int
,
fieldValues
string
)
bool
{
success
,
_
:=
rbac
.
Ef
.
RemoveFilteredNamedPolicy
(
ptype
,
fieldIndex
,
fieldValues
)
return
success
}
service/casbin_service/casbin_rule.go
View file @
be2ed024
...
...
@@ -39,7 +39,7 @@ func (r *SetPermission) AddPolicy() error {
for
_
,
v
:=
range
r
.
AllowPermissions
{
rules
=
append
(
rules
,
[]
string
{
r
.
Value
,
v
.
Path
,
v
.
Method
})
}
models
.
ClearCasbin
(
"p"
,
0
,
r
.
Value
)
models
.
RemovePolicy
(
"p"
,
0
,
r
.
Value
)
models
.
AddPolicy
(
rules
)
return
nil
}
...
...
@@ -49,7 +49,7 @@ func (r *CasbinRole) AddGroupingPolicy() error {
"v0"
:
r
.
V0
,
"v1"
:
r
.
V1
,
}
models
.
RemoveGroupingPolicy
(
"g"
,
0
,
r
.
V0
)
if
err
:=
models
.
AddGroupingPolicy
(
role
);
err
!=
nil
{
return
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment