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
efc9a4b3
Commit
efc9a4b3
authored
Apr 18, 2022
by
Melledy
Browse files
Grant superuser permissions to accounts created before the permissions update
parent
4cf734fb
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/Account.java
View file @
efc9a4b3
...
@@ -4,6 +4,7 @@ import dev.morphia.annotations.Collation;
...
@@ -4,6 +4,7 @@ import dev.morphia.annotations.Collation;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Id
;
import
dev.morphia.annotations.Id
;
import
dev.morphia.annotations.Indexed
;
import
dev.morphia.annotations.Indexed
;
import
dev.morphia.annotations.PreLoad
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.utils.Crypto
;
import
emu.grasscutter.utils.Crypto
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
...
@@ -12,6 +13,8 @@ import dev.morphia.annotations.IndexOptions;
...
@@ -12,6 +13,8 @@ import dev.morphia.annotations.IndexOptions;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
com.mongodb.DBObject
;
@Entity
(
value
=
"accounts"
,
noClassnameStored
=
true
)
@Entity
(
value
=
"accounts"
,
noClassnameStored
=
true
)
public
class
Account
{
public
class
Account
{
@Id
private
String
id
;
@Id
private
String
id
;
...
@@ -114,6 +117,14 @@ public class Account {
...
@@ -114,6 +117,14 @@ public class Account {
return
this
.
token
;
return
this
.
token
;
}
}
@PreLoad
public
void
onLoad
(
DBObject
dbObj
)
{
// Grant the superuser permissions to accounts created before the permissions update
if
(!
dbObj
.
containsField
(
"permissions"
))
{
this
.
addPermission
(
"*"
);
}
}
public
void
save
()
{
public
void
save
()
{
DatabaseHelper
.
saveAccount
(
this
);
DatabaseHelper
.
saveAccount
(
this
);
}
}
...
...
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