Skip to content

Commit

Permalink
fix(ldap-roles): rename all remaining ldap roles
Browse files Browse the repository at this point in the history
  • Loading branch information
velrest committed Aug 26, 2021
1 parent f5117d5 commit 6de85c8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ provisioning/rt4/var/mason_data
provisioning/rt4/var/rt4
millis-test-sync
frontend/root
frontend/tmp
ldap/lib
ldap/slapd.d
3 changes: 2 additions & 1 deletion frontend/app/ui/application/controller.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import ENV from "customer-center/config/environment";

export default class ApplicationController extends Controller {
@service account;
@service session;
@service intl;

get showConfirmInMenu() {
return this.account.isInGroup("admin");
return this.account.isInGroup(ENV.auth.adminRole);
}

get languages() {
Expand Down
3 changes: 2 additions & 1 deletion frontend/app/ui/subscriptions/confirm/route.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject as service } from "@ember/service";
import ENV from "customer-center/config/environment";
import AuthenticatedRoute from "customer-center/routes/-authenticated";

export default class SubscriptionsConfirmRoute extends AuthenticatedRoute {
Expand All @@ -10,7 +11,7 @@ export default class SubscriptionsConfirmRoute extends AuthenticatedRoute {
beforeModel(transition) {
super.beforeModel(transition);

if (!this.account.isInGroup("admin")) {
if (!this.account.isInGroup(ENV.auth.adminRole)) {
this.notify.error(this.intl.t("page.subscriptions.confirm.no-access"));
this.transitionTo("subscriptions.index");
}
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/ui/subscriptions/detail/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Controller from "@ember/controller";
import { action, get } from "@ember/object";
import { inject as service } from "@ember/service";
import { tracked } from "@glimmer/tracking";
import ENV from "customer-center/config/environment";
import { task } from "ember-concurrency-decorators";

export default class SubscriptionsDetailController extends Controller {
Expand All @@ -16,7 +17,10 @@ export default class SubscriptionsDetailController extends Controller {
@tracked reportsNext;

get showReloadButton() {
return this.account.isInGroups("one", ["admin", "adsy-customer"]);
return this.account.isInGroups("one", [
ENV.auth.adminRole,
ENV.auth.customerRole,
]);
}

get breadcrumbs() {
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/ui/subscriptions/own/controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Controller from "@ember/controller";
import { alias } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import ENV from "customer-center/config/environment";

export default class SubscriptionsOwnController extends Controller {
@service account;
Expand All @@ -9,7 +10,10 @@ export default class SubscriptionsOwnController extends Controller {
@alias("model") projects;

get showReloadLink() {
return this.account.isInGroups("one", ["admin", "adsy-customer"]);
return this.account.isInGroups("one", [
ENV.auth.adminRole,
ENV.auth.customerRole,
]);
}

breadcrumbs = [
Expand Down
8 changes: 6 additions & 2 deletions frontend/app/ui/subscriptions/reload/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { tracked } from "@glimmer/tracking";
import ENV from "customer-center/config/environment";
import { Changeset } from "ember-changeset";
import moment from "moment";
import UIkit from "uikit";
Expand All @@ -18,11 +19,14 @@ export default class SubscriptionsReloadController extends Controller {
@tracked changeset;

get showForm() {
return this.account.isInGroup("admin");
return this.account.isInGroup(ENV.auth.adminRole);
}

get showPackages() {
return this.account.isInGroups("all", ["timed", "adsy-customer"]);
return this.account.isInGroups("all", [
ENV.auth.timedRole,
ENV.auth.customerRole,
]);
}

get breadcrumbs() {
Expand Down
10 changes: 8 additions & 2 deletions frontend/app/ui/subscriptions/reload/route.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject as service } from "@ember/service";
import ENV from "customer-center/config/environment";
import AuthenticatedRoute from "customer-center/routes/-authenticated";

export default class SubscriptionsReloadRoute extends AuthenticatedRoute {
Expand All @@ -11,7 +12,12 @@ export default class SubscriptionsReloadRoute extends AuthenticatedRoute {
super.beforeModel(transition);

// Normal users cannot recharge the subscription.
if (!this.account.isInGroups("one", ["admin", "adsy-customer"])) {
if (
!this.account.isInGroups("one", [
ENV.auth.adminRole,
ENV.auth.customerRole,
])
) {
this.notify.error(this.intl.t("page.subscriptions.reload.no-access"));
this.transitionTo(
"subscriptions.detail",
Expand All @@ -25,7 +31,7 @@ export default class SubscriptionsReloadRoute extends AuthenticatedRoute {

// Customers get a list of packages to choose from.
let packages = [];
if (this.account.isInGroup("adsy-customer")) {
if (this.account.isInGroup(ENV.auth.customerRole)) {
const billing_type = project.billingType.get("id");
packages = await this.timed.getReloadPackages(billing_type);
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module.exports = function (environment) {
auth: {
adminRole: env("AUTH_ROLE_ADMIN", "admin"),
employeeRole: env("AUTH_ROLE_EMPLOYEE", "employees"),
timedRole: env("AUTH_ROLE_TIMED", "timed"),
customerRole: env("AUTH_ROLE_CUSTOMER", "adsy-customer"),
},

EmberENV: {
Expand Down

0 comments on commit 6de85c8

Please sign in to comment.