Beter group check and isAuthenticated()
This commit is contained in:
parent
794c885ac1
commit
6750c05f07
15
core/user.js
15
core/user.js
|
@ -26,6 +26,10 @@ function User() {
|
|||
this.properties = {}; // name:value
|
||||
this.groups = []; // group membership(s)
|
||||
|
||||
this.isAuthenticated = function() {
|
||||
return true === self.authenticated;
|
||||
}
|
||||
|
||||
this.isValid = function() {
|
||||
if(self.userId <= 0 || self.username.length < Config.users.usernameMin) {
|
||||
return false;
|
||||
|
@ -54,13 +58,16 @@ function User() {
|
|||
groupNames = [ groupNames ];
|
||||
}
|
||||
|
||||
groupNames.forEach(function groupEntry(groupName) {
|
||||
if(-1 === self.groups.indexOf(groupName)) {
|
||||
return false;
|
||||
var isMember = false;
|
||||
|
||||
_.forEach(groupNames, groupName => {
|
||||
if(-1 !== self.groups.indexOf(groupName)) {
|
||||
isMember = true;
|
||||
return false; // stop iteration
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
return isMember;
|
||||
};
|
||||
|
||||
this.getLegacySecurityLevel = function() {
|
||||
|
|
Loading…
Reference in New Issue