mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Leave out roles array in serialized user
Leave out the roles property containing the array of role ids if the user does not have any roles.
This commit is contained in:
1 parent
9761fbb71c
commit
5e5a47ce02
2 files changed
+17
-7
No files matched your search
+4
-1
@@ -173,9 +173,12 @@ class User {
|
||||
serialize() {
|
||||
let serialized = {
|
||||
name: this.name,
|
||||
roles: [...this.roles].map(role => role.id),
|
||||
};
|
||||
|
||||
if (this.roles.size) {
|
||||
serialized.roles = [...this.roles].map(role => role.id);
|
||||
}
|
||||
|
||||
if (this.tokenValidAfter) {
|
||||
serialized.tokenValidAfter = this.tokenValidAfter;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user