Allow admins to see the group reports nav item (#101)

Previously, the report tab would appear only if the user was a member of the group. With this change, admins can see the reports in any group.
This commit is contained in:
Grayden 2021-04-08 10:50:49 -04:00 committed by GitHub
parent cc69d28229
commit 82cb3ac2fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -13,9 +13,12 @@ export default Ember.Component.extend({
init(args) { init(args) {
this.set("group", args.group); this.set("group", args.group);
if ( if (
(this.get("currentUser.groups") || []).some((g) => g.id === this.group.id) (this.get("currentUser.groups") || []).some(
(g) => g.id === this.group.id
) ||
this.get("currentUser.admin")
) { ) {
// User is a part of the group. Now check if the group has reports // User is a part of the group (or an admin). Now check if the group has reports
this.checkForReports(); this.checkForReports();
} }