Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
922359d6
Commit
922359d6
authored
May 14, 2022
by
muhammadeko
Committed by
Melledy
May 13, 2022
Browse files
add negative permission check
parent
20e3b8ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/Account.java
View file @
922359d6
...
@@ -144,12 +144,20 @@ public class Account {
...
@@ -144,12 +144,20 @@ public class Account {
}
}
public
boolean
hasPermission
(
String
permission
)
{
public
boolean
hasPermission
(
String
permission
)
{
if
(
this
.
permissions
.
contains
(
permission
)
||
this
.
permissions
.
contains
(
"*"
)
)
{
if
(
this
.
permissions
.
contains
(
permission
))
{
return
true
;
return
true
;
}
}
if
(
this
.
permissions
.
contains
(
"*"
)
&&
this
.
permissions
.
contains
(
"-"
+
permission
))
{
return
false
;
}
String
[]
permissionParts
=
permission
.
split
(
"\\."
);
String
[]
permissionParts
=
permission
.
split
(
"\\."
);
for
(
String
p
:
this
.
permissions
)
{
for
(
String
p
:
this
.
permissions
)
{
if
(
p
.
startsWith
(
"-"
)
&&
permissionMatchesWildcard
(
p
.
substring
(
1
),
permissionParts
))
{
return
false
;
}
if
(
permissionMatchesWildcard
(
p
,
permissionParts
))
{
if
(
permissionMatchesWildcard
(
p
,
permissionParts
))
{
Grasscutter
.
getLogger
().
info
(
"Permission "
+
p
+
" matches "
+
permission
);
return
true
;
return
true
;
}
}
}
}
...
...
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