1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

implemented view users permission

This commit is contained in:
Harvey Kandola 2017-10-04 12:27:56 -04:00
parent f5f30d2322
commit 30321781c2
13 changed files with 423 additions and 388 deletions

View file

@ -26,12 +26,15 @@ export default SimpleAuthSession.extend({
currentFolder: null,
isMac: false,
isMobile: false,
hasAccounts: computed('isAuthenticated', 'session.content.authenticated.user', function() {
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.accounts').length > 0;
}),
accounts: computed('hasAccounts', function() {
return this.get('session.content.authenticated.user.accounts');
}),
user: computed('isAuthenticated', 'session.content.authenticated.user', function () {
if (this.get('isAuthenticated')) {
let user = this.get('session.content.authenticated.user') || { id: '0' };
@ -39,28 +42,32 @@ export default SimpleAuthSession.extend({
return this.get('store').push(data);
}
}),
authenticated: computed('session.content.authenticated.user', function () {
return this.get('session.authenticator') !== 'authenticator:anonymous' && this.get('session.content.authenticated.user.id') !== '0';
}),
isAdmin: computed('session.content.authenticated.user', function () {
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
this.get('session.content.authenticated.user.id') !== '0' &&
this.get('session.content.authenticated.user.admin') === true;
}),
isEditor: computed('session.content.authenticated.user', function () {
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
this.get('session.content.authenticated.user.id') !== '0' &&
this.get('session.content.authenticated.user.editor') === true;
}),
isGlobalAdmin: computed('session.content.authenticated.user', function () {
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
return this.get('session.authenticator') !== 'authenticator:anonymous' &&
this.get('session.content.authenticated.user.id') !== '0' &&
this.get('session.content.authenticated.user.global') === true;
}),
init() {
this._super(...arguments);
this.set('isMac', is.mac());
this.set('isMobile', is.mobile());
},