check for currentUser in permissions

This commit is contained in:
lislis 2016-03-22 12:24:44 +01:00 committed by Piotr Sarnacki
parent 71c55779a1
commit e66efc1cbc

View File

@ -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);
}
}
};