1
0
mirror of https://github.com/NginxProxyManager/nginx-proxy-manager.git synced 2025-09-02 23:21:14 +03:00

Ongoing rewrite work

This commit is contained in:
Jamie Curnow
2018-07-09 11:22:10 +10:00
parent 30924a6922
commit 54d220a191
72 changed files with 3656 additions and 113 deletions

View File

@@ -17,8 +17,33 @@ const model = Backbone.Model.extend({
};
},
/**
* @returns {Boolean}
*/
isAdmin: function () {
return _.indexOf(this.get('roles'), 'admin') !== -1;
},
/**
* Checks if the perm has either `view` or `manage` value
*
* @param {String} item
* @returns {Boolean}
*/
canView: function (item) {
let permissions = this.get('permissions');
return permissions !== null && typeof permissions[item] !== 'undefined' && ['view', 'manage'].indexOf(permissions[item]) !== -1;
},
/**
* Checks if the perm has `manage` value
*
* @param {String} item
* @returns {Boolean}
*/
canManage: function (item) {
let permissions = this.get('permissions');
return permissions !== null && typeof permissions[item] !== 'undefined' && permissions[item] === 'manage';
}
});