Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions api/utils/rights.js
Original file line number Diff line number Diff line change
Expand Up @@ -1155,15 +1155,25 @@ exports.hasAdminAccess = function(member, app_id, type) {
return true;
}

var isAdmin = true;
var isAdmin = false;
// check users who has permission property
if (hasPermissionObject) {
var types = type ? [type] : ["c", "r", "u", "d"];
var passesAllRules = true;
for (var i = 0; i < types.length; i++) {
if (member.permission[types[i]] && member.permission[types[i]][app_id] && !member.permission[types[i]][app_id].all) {
isAdmin = false;
if (member.permission[types[i]] && member.permission[types[i]][app_id]) {
if (!member.permission[types[i]][app_id].all) {
passesAllRules = false;
}
}
else {
passesAllRules = false;
}
}
if (passesAllRules) {
isAdmin = true;
}

}
// check legacy users who has admin_of property
// users should have at least one app in admin_of array
Expand Down
Loading