Skip to content

Commit

Permalink
Only allow staff to add/edit the analytics url
Browse files Browse the repository at this point in the history
  • Loading branch information
richardhallett committed Jun 3, 2022
1 parent 7e5cdc5 commit 9a3b556
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/abilities/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,13 @@ export default Ability.extend({
default:
return false;
}
}),
canSetAnalyticsUrl: computed('currentUser.role_id', function () {
switch (this.get('currentUser.role_id')) {
case 'staff_admin':
return true;
default:
return false;
}
})
});
4 changes: 2 additions & 2 deletions app/templates/providers/show/repositories/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
</div>
{{/if}}

{{!-- {{#if (show-analytics)}} --}}
{{#if (can "setAnalyticsUrl repository" model)}}
<form.element @controlType="text" @id="analytics-dashboard-url" @label="Analytics Dashboard URL" @property="analyticsDashboardUrl" @helpText="The Analytics Dashboard URL is the shared link generated within the analytics app settings for this repository. It should only be set if analytics has been turned on for a repository." />
{{!-- {{/if}} --}}
{{/if}}

<form.element @controlType="checkbox" @id="is-active" @label="Account is active" @property="isActive" @helpText="This account can register and update DOIs" />

Expand Down
4 changes: 2 additions & 2 deletions app/templates/repositories/show/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
</div>
{{/if}}

{{!-- {{#if (show-analytics)}} --}}
{{#if (can "setAnalyticsUrl repository" model)}}
<form.element @controlType="text" @id="analytics-dashboard-url" @label="Analytics Dashboard URL" @property="analyticsDashboardUrl" @helpText="The Analytics Dashboard URL is the shared link generated within the analytics app settings for this repository. It should only be set if analytics has been turned on for a repository." />
{{!-- {{/if}} --}}
{{/if}}

{{#if (can "create repository" model)}}
<form.element @controlType="checkbox" @id="is-active" @label="Account is active" @property="isActive" @helpText="This account can register and update DOIs" />
Expand Down

0 comments on commit 9a3b556

Please sign in to comment.