Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrates event roles API in admin permissions tab
- Loading branch information
1 parent
4d50c55
commit b71c70c
Showing
8 changed files
with
80 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Controller from '@ember/controller'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default Controller.extend({ | ||
services: computed('model', function() { | ||
return this.get('model.services').sortBy('name'); | ||
}), | ||
sortDefinition : ['serviceName'], | ||
permissions : computed.sort('model.permissions', 'sortDefinition'), | ||
actions : { | ||
updatePermissions() { | ||
this.set('isLoading', true); | ||
this.get('model.permissions').save() | ||
.then(() => { | ||
this.notify.success(this.get('l10n').t('Admin Event role permissions have been saved successfully.')); | ||
}) | ||
.catch(() => { | ||
this.notify.error(this.get('l10n').t('An unexpected error has occurred. User permissions not saved.')); | ||
}) | ||
.finally(() => { | ||
this.set('isLoading', false); | ||
}); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import attr from 'ember-data/attr'; | ||
import ModelBase from 'open-event-frontend/models/base'; | ||
import { belongsTo } from 'ember-data/relationships'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default ModelBase.extend({ | ||
canDelete : attr('boolean'), | ||
canUpdate : attr('boolean'), | ||
canCreate : attr('boolean'), | ||
canRead : attr('boolean'), | ||
|
||
role : belongsTo('role'), | ||
service : belongsTo('service'), | ||
serviceName : computed.alias('service.name') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import attr from 'ember-data/attr'; | ||
import ModelBase from 'open-event-frontend/models/base'; | ||
|
||
export default ModelBase.extend({ | ||
name: attr('string') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
export default Route.extend({ | ||
model() { | ||
return { roles: ['Attendee', 'Co-Organizer', 'Moderator', 'Organizer', 'Track Organizer'] }; | ||
}, | ||
titleToken() { | ||
return this.get('l10n').t('Event Roles'); | ||
}, | ||
async model() { | ||
return { | ||
roles : ['Attendee', 'Co-organizer', 'Moderator', 'Organizer', 'Track Organizer', 'Registrar'], | ||
services : await this.get('store').query('service', {}), | ||
permissions : await this.get('store').query('event-role-permission', { 'page[size]': 30 }) | ||
}; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters