Better isGroupMember() impl.
This commit is contained in:
parent
e7ba6c406e
commit
2c53515b60
22
core/user.js
22
core/user.js
|
@ -60,28 +60,20 @@ function User() {
|
||||||
groupNames = [ groupNames ];
|
groupNames = [ groupNames ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: _.some()
|
const isMember = groupNames.some(gn => (-1 !== self.groups.indexOf(gn)));
|
||||||
|
|
||||||
var isMember = false;
|
|
||||||
|
|
||||||
_.forEach(groupNames, groupName => {
|
|
||||||
if(-1 !== self.groups.indexOf(groupName)) {
|
|
||||||
isMember = true;
|
|
||||||
return false; // stop iteration
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return isMember;
|
return isMember;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getLegacySecurityLevel = function() {
|
this.getLegacySecurityLevel = function() {
|
||||||
if(self.isRoot() || self.isGroupMember('sysops')) {
|
if(self.isRoot() || self.isGroupMember('sysops')) {
|
||||||
return 100;
|
return 100;
|
||||||
} else if(self.isGroupMember('users')) {
|
|
||||||
return 30;
|
|
||||||
} else {
|
|
||||||
return 10; // :TODO: Is this what we want?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(self.isGroupMember('users')) {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 10; // :TODO: Is this what we want?
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue