check for currentUser in permissions
This commit is contained in:
parent
71c55779a1
commit
e66efc1cbc
|
@ -2,24 +2,30 @@
|
|||
var hasPermission = function(currentUser, repoId) {
|
||||
var id = parseInt(repoId);
|
||||
var permissions;
|
||||
if (permissions = currentUser.get('permissions')) {
|
||||
return permissions.contains(id);
|
||||
if (currentUser) {
|
||||
if (permissions = currentUser.get('permissions')) {
|
||||
return permissions.contains(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var hasPushPermission = function(currentUser, repoId) {
|
||||
var id = parseInt(repoId);
|
||||
var permissions;
|
||||
if (permissions = currentUser.get('pushPermissions')) {
|
||||
return permissions.contains(id);
|
||||
if (currentUser) {
|
||||
if (permissions = currentUser.get('pushPermissions')) {
|
||||
return permissions.contains(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var hasAdminPermission = function(currentUser, repoId) {
|
||||
var id = parseInt(repoId);
|
||||
var permissions;
|
||||
if (permissions = currentUser.get('adminPermissions')) {
|
||||
return permissions.contains(id);
|
||||
if (currentUser) {
|
||||
if (permissions = currentUser.get('adminPermissions')) {
|
||||
return permissions.contains(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user