FIX: Don't show logs if user is not an admin or group owner.
This commit is contained in:
parent
5db6306218
commit
405ffbf5a4
|
@ -21,7 +21,10 @@ export default Ember.Controller.extend({
|
|||
Tab.create({ name: 'topics' }),
|
||||
Tab.create({ name: 'mentions' }),
|
||||
Tab.create({ name: 'messages', requiresMembership: true }),
|
||||
Tab.create({ name: 'logs', i18nKey: 'logs.title', icon: 'shield', requiresMembership: true })
|
||||
Tab.create({
|
||||
name: 'logs', i18nKey: 'logs.title', icon: 'shield',
|
||||
requiresMembership: true, requiresGroupAdmin: true
|
||||
})
|
||||
],
|
||||
|
||||
@computed('model.is_group_owner', 'model.automatic')
|
||||
|
@ -58,13 +61,19 @@ export default Ember.Controller.extend({
|
|||
});
|
||||
},
|
||||
|
||||
@computed('model.is_group_user')
|
||||
getTabs(isGroupUser) {
|
||||
@computed('model.is_group_user', 'model.is_group_owner')
|
||||
getTabs(isGroupUser, isGroupOwner) {
|
||||
return this.get('tabs').filter(t => {
|
||||
let isMember = false;
|
||||
|
||||
if (this.currentUser) {
|
||||
isMember = this.currentUser.admin || isGroupUser;
|
||||
let admin = this.currentUser.admin;
|
||||
|
||||
if (t.get('requiresGroupAdmin')) {
|
||||
isMember = admin || isGroupOwner;
|
||||
} else {
|
||||
isMember = admin || isGroupUser;
|
||||
}
|
||||
}
|
||||
|
||||
return isMember || !t.get('requiresMembership');
|
||||
|
|
Loading…
Reference in New Issue