Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: edit event accessible to user with event roles only #3500

Merged
merged 3 commits into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion app/routes/events/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default Route.extend({

model(params) {
return this.store.findRecord('event', params.event_id, {
include: 'event-topic,event-sub-topic,event-type,event-copyright,tax,owner,stripe-authorization'
include: 'event-topic,event-sub-topic,event-type,event-copyright,tax,owner,organizers,coorganizers,track-organizers,registrars,moderators,stripe-authorization'
});
},

Expand Down
8 changes: 8 additions & 0 deletions app/routes/events/view/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ export default Route.extend(AuthenticatedRouteMixin, EventWizardMixin, {
if (transition.targetName === 'events.view.edit.index') {
this.transitionTo('events.view.edit.basic-details');
}

let event = this.modelFor('events.view');
let { currentUser } = this.authManager;
if (!(currentUser.isAnAdmin || currentUser.email === event.owner.get('email') || event.organizers.includes(currentUser)
|| event.coorganizers.includes(currentUser) || event.trackOrganizers.includes(currentUser)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shreyanshdwivedi Just make sure if this hierarchy correct, I mean not every event role should have access to Edit Page. Confirm with @CosmicCoder96 or @mariobehling once, Else it is gtg.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think currently we are giving full access to all the event roles. @CosmicCoder96 is there any role which is needed to be removed?

|| event.registrars.includes(currentUser) || event.moderators.includes(currentUser))) {
this.transitionTo('index');
}
},

async model() {
Expand Down
8 changes: 5 additions & 3 deletions app/templates/components/modals/add-user-role-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
</div>
<div class="menu">
{{#each data.roles as |role|}}
<div class="item" data-value="{{map-value mapper role}}">
{{role.name}}
</div>
{{#if (not-eq role.name 'owner')}}
<div class="item" data-value="{{map-value mapper role}}">
{{role.name}}
</div>
{{/if}}
{{/each}}
</div>
{{/ui-dropdown}}
Expand Down