From ab57109671a151077592e3a602965278fed03895 Mon Sep 17 00:00:00 2001 From: Jonas Cosandey Date: Thu, 5 Jul 2018 12:55:52 +0200 Subject: [PATCH 1/6] add new access type to frontend and rename sysupport to timed --- backend/config-test.js | 2 +- backend/config.example.js | 3 + backend/src/app.js | 2 +- backend/src/login/index.js | 8 +-- backend/src/services.js | 4 +- backend/src/{sysupport => timed}/custom.js | 0 backend/src/{sysupport => timed}/proxy.js | 9 ++- backend/src/{sysupport => timed}/token.js | 0 backend/src/user/model.js | 14 ++++- frontend/app/adapters/application.js | 2 +- frontend/app/gitlab/route.js | 5 +- frontend/app/helpers/format-duration.js | 4 +- frontend/app/locales/de/translations.js | 10 ++-- frontend/app/locales/en/translations.js | 10 ++-- frontend/app/mixins/route-access-mixin.js | 13 ++++- frontend/app/models/user.js | 8 ++- frontend/app/protected/template.hbs | 24 ++++---- frontend/app/router.js | 4 +- .../confirm-subscriptions/route.js | 6 +- .../confirm-subscriptions/template.hbs | 10 ++-- .../detail/controller.js | 11 +++- .../detail/route.js | 0 .../detail/template.hbs | 34 +++++------ .../index/controller.js | 14 ++--- .../index/route.js | 2 +- .../index/template.hbs | 4 +- .../route.js | 5 +- .../template.hbs | 0 .../detail/index/route.js | 2 +- .../detail/index/template.hbs | 18 +++--- .../detail/reload/controller.js | 6 +- .../detail/reload/route.js | 4 +- .../detail/reload/template.hbs | 6 +- .../detail/route.js | 0 .../index/route.js | 2 +- .../index/template.hbs | 16 +++--- .../route.js | 5 +- .../template.hbs | 0 frontend/config/environment.js | 11 ++-- frontend/mirage/config.js | 30 ++++------ frontend/mirage/factories/user.js | 11 +++- frontend/mirage/scenarios/default.js | 3 +- ...port-admin-test.js => timed-admin-test.js} | 20 +++---- .../timed-subscription-project-detail-test.js | 12 ++-- .../unit/helpers/service-enabled-test.js | 2 +- .../unit/mixins/route-access-mixin-test.js | 18 ++++-- .../confirm-subscriptions/route-test.js | 11 ---- .../detail/reload/route-test.js | 11 ---- .../confirm-subscriptions}/route-test.js | 4 +- .../detail/controller-test.js | 12 ++-- .../detail}/route-test.js | 4 +- .../index/controller-test.js | 4 +- .../index/route-test.js | 4 +- .../route-test.js | 4 +- .../detail/index/route-test.js | 11 ++++ .../detail/reload/route-test.js | 11 ++++ .../index}/route-test.js | 4 +- tools/docker/ldap/ldap.ldif/default.ldif | 56 ++++++++++++++++--- tools/docker/postgres/timed-test-data.sql | 6 +- tools/docker/ucs/scripts/create-new-admin.sh | 4 +- yarn.lock | 4 ++ 61 files changed, 314 insertions(+), 210 deletions(-) rename backend/src/{sysupport => timed}/custom.js (100%) rename backend/src/{sysupport => timed}/proxy.js (94%) rename backend/src/{sysupport => timed}/token.js (100%) rename frontend/app/{sysupport-admin => timed-admin}/confirm-subscriptions/route.js (77%) rename frontend/app/{sysupport-admin => timed-admin}/confirm-subscriptions/template.hbs (83%) rename frontend/app/{sysupport-admin => timed-admin}/detail/controller.js (89%) rename frontend/app/{sysupport-admin => timed-admin}/detail/route.js (100%) rename frontend/app/{sysupport-admin => timed-admin}/detail/template.hbs (84%) rename frontend/app/{sysupport-admin => timed-admin}/index/controller.js (78%) rename frontend/app/{sysupport-admin => timed-admin}/index/route.js (88%) rename frontend/app/{sysupport-admin => timed-admin}/index/template.hbs (93%) rename frontend/app/{sysupport-subscriptions => timed-admin}/route.js (66%) rename frontend/app/{sysupport-admin => timed-admin}/template.hbs (100%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/index/route.js (84%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/index/template.hbs (79%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/reload/controller.js (78%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/reload/route.js (77%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/reload/template.hbs (90%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/detail/route.js (100%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/index/route.js (84%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/index/template.hbs (63%) rename frontend/app/{sysupport-admin => timed-subscriptions}/route.js (68%) rename frontend/app/{sysupport-subscriptions => timed-subscriptions}/template.hbs (100%) rename frontend/tests/acceptance/{sysupport-admin-test.js => timed-admin-test.js} (86%) delete mode 100644 frontend/tests/unit/sysupport-admin/confirm-subscriptions/route-test.js delete mode 100644 frontend/tests/unit/sysupport-subscriptions/detail/reload/route-test.js rename frontend/tests/unit/{sysupport-subscriptions/detail/index => timed-admin/confirm-subscriptions}/route-test.js (51%) rename frontend/tests/unit/{sysupport-admin => timed-admin}/detail/controller-test.js (87%) rename frontend/tests/unit/{sysupport-admin/index => timed-admin/detail}/route-test.js (56%) rename frontend/tests/unit/{sysupport-admin => timed-admin}/index/controller-test.js (87%) rename frontend/tests/unit/{sysupport-subscriptions => timed-admin}/index/route-test.js (55%) rename frontend/tests/unit/{sysupport-admin => timed-admin}/route-test.js (58%) create mode 100644 frontend/tests/unit/timed-subscriptions/detail/index/route-test.js create mode 100644 frontend/tests/unit/timed-subscriptions/detail/reload/route-test.js rename frontend/tests/unit/{sysupport-admin/detail => timed-subscriptions/index}/route-test.js (55%) create mode 100644 yarn.lock diff --git a/backend/config-test.js b/backend/config-test.js index 756610bc..88edc36f 100644 --- a/backend/config-test.js +++ b/backend/config-test.js @@ -86,7 +86,7 @@ module.exports = { timed: { type: 'timed', host: 'http://timedbackend', - user: 'sysupport_api', + user: 'timed_api', password: 'hallo123', prefix: '/api/v1', authPath: '/auth/login', diff --git a/backend/config.example.js b/backend/config.example.js index b3a63758..72ed4237 100644 --- a/backend/config.example.js +++ b/backend/config.example.js @@ -12,6 +12,9 @@ module.exports = { cert: '/path/to/root_ca_cert.crt' }, login: { + adminRole: 'some-role', + internRole: 'some-other-role', + ldap: { // Further information how to configure LDAP under: // https://github.com/vesse/passport-ldapauth diff --git a/backend/src/app.js b/backend/src/app.js index 369a18e9..0c9f60af 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -10,7 +10,7 @@ import passwordreset from './password-reset' import services from './services' import userRoute from './user/route' import vaultTokenRenewer from './vault/vault-token' -import { timedTokenRenew } from './sysupport/token' +import { timedTokenRenew } from './timed/token' import config from './config' const app = express() diff --git a/backend/src/login/index.js b/backend/src/login/index.js index c58803e5..25b94b72 100644 --- a/backend/src/login/index.js +++ b/backend/src/login/index.js @@ -5,8 +5,8 @@ import passport from 'passport' import LdapStrategy from 'passport-ldapauth' import User from '../user/model' import config from '../config' -import { timedLogin } from '../sysupport/token' -import { getCustomer as getTimedCustomer } from '../sysupport/custom' +import { timedLogin } from '../timed/token' +import { getCustomer as getTimedCustomer } from '../timed/custom' passport.use( 'ldapauth-user', @@ -115,8 +115,8 @@ function loginSuccessful(req, res, next, ldapUser) { ) } - // If user is in the sysupport group, get timed token - if (isMember('sysupport')) { + // If user is in the timed group, get timed token + if (isMember('timed')) { req.session = await addTimedTokenToSession( req.session, users.get(ldapUser) diff --git a/backend/src/services.js b/backend/src/services.js index 1d9287f1..f2fddf8e 100644 --- a/backend/src/services.js +++ b/backend/src/services.js @@ -1,7 +1,7 @@ import express from 'express' import VaultProxy from './vault/vault-proxy' import vaultCustom from './vault/vault-custom' -import SysupportProxy from './sysupport/proxy' +import TimedProxy from './timed/proxy' import gitlabProxy from './gitlab/proxy' import config from './config' @@ -12,7 +12,7 @@ const { vault, timed, gitlab } = config.services router.use('/vault', vaultCustom(vault)) router.use('/proxy/vault', VaultProxy.createProxy(vault)) -router.use('/proxy/sysupport', SysupportProxy.createProxy(timed)) +router.use('/proxy/timed', TimedProxy.createProxy(timed)) router.use('/proxy/gitlab', gitlabProxy(gitlab)) diff --git a/backend/src/sysupport/custom.js b/backend/src/timed/custom.js similarity index 100% rename from backend/src/sysupport/custom.js rename to backend/src/timed/custom.js diff --git a/backend/src/sysupport/proxy.js b/backend/src/timed/proxy.js similarity index 94% rename from backend/src/sysupport/proxy.js rename to backend/src/timed/proxy.js index 02359469..247b6fbc 100644 --- a/backend/src/sysupport/proxy.js +++ b/backend/src/timed/proxy.js @@ -6,6 +6,7 @@ const routes = { path: /^\/subscription-projects(\/[1-9][0-9]*|)$/, access: { admin: ['GET'], + user: ['GET'], customer: ['GET'] } }, @@ -19,13 +20,15 @@ const routes = { path: /^\/subscription-orders$/, access: { admin: ['GET', 'DELETE', 'POST'], + user: ['GET', 'DELETE'], customer: ['GET', 'POST'] } }, subscriptionOrder: { path: /^\/subscription-orders\/[1-9][0-9]*$/, access: { - admin: ['DELETE'] + admin: ['DELETE'], + user: ['DELETE'] } }, subscriptionOrderConfirm: { @@ -38,13 +41,15 @@ const routes = { path: /^\/reports$/, access: { admin: ['GET'], + user: ['GET'], customer: ['GET'] } }, customer: { path: /^\/customers(\/[1-9][0-9]*|)$/, access: { - admin: ['GET'] + admin: ['GET'], + user: ['GET'] } } } diff --git a/backend/src/sysupport/token.js b/backend/src/timed/token.js similarity index 100% rename from backend/src/sysupport/token.js rename to backend/src/timed/token.js diff --git a/backend/src/user/model.js b/backend/src/user/model.js index 6cd9a567..e1c4a337 100644 --- a/backend/src/user/model.js +++ b/backend/src/user/model.js @@ -6,8 +6,7 @@ const { isArray } = Array const bookshelf = new Bookshelf(knex(config.database)) /** - * User model - * + * User model * * @class User * @public */ @@ -71,6 +70,17 @@ export default bookshelf.Model.extend( return this.getGroupNames().includes(config.login.adminRole) }, + /** + * Check if user is inter + * + * @returns {boolean} + * @public + * @author Jonas Cosandey (jonas.cosandey@adfinis-sygroup.ch) + */ + isAdsyUser() { + return this.getGroupNames().includes(config.login.internRole) + }, + /** * Does this user have redmine access? * diff --git a/frontend/app/adapters/application.js b/frontend/app/adapters/application.js index 79197e2b..a481a8e5 100644 --- a/frontend/app/adapters/application.js +++ b/frontend/app/adapters/application.js @@ -2,7 +2,7 @@ import DS from 'ember-data' import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin' export default DS.JSONAPIAdapter.extend(DataAdapterMixin, { - namespace: '/api/proxy/sysupport', + namespace: '/api/proxy/timed', authorize(xhr) { if (this.get('session.data.authenticated.data.token')) { xhr.setRequestHeader( diff --git a/frontend/app/gitlab/route.js b/frontend/app/gitlab/route.js index 26283d4f..904eb068 100644 --- a/frontend/app/gitlab/route.js +++ b/frontend/app/gitlab/route.js @@ -6,7 +6,10 @@ import { computed } from '@ember/object' export default Route.extend(RouteAccessMixin, { //specify which groups have access to this route. - groups: computed(() => ['adsy-customer', 'gitlab']), + groups: computed(() => ({ + requireAll: ['gitlab'], + requireOne: ['adsy-customer'] + })), i18n: service(), session: service(), diff --git a/frontend/app/helpers/format-duration.js b/frontend/app/helpers/format-duration.js index 2866c7a8..593d09e5 100644 --- a/frontend/app/helpers/format-duration.js +++ b/frontend/app/helpers/format-duration.js @@ -12,8 +12,8 @@ export default Helper.extend({ hoursCount: 0, minutesCount: 0, - hoursTranslation: t('sysupport.durations.hour', { count: 'hoursCount' }), - minutesTranslation: t('sysupport.durations.minute', { + hoursTranslation: t('timed.durations.hour', { count: 'hoursCount' }), + minutesTranslation: t('timed.durations.minute', { count: 'minutesCount' }), diff --git a/frontend/app/locales/de/translations.js b/frontend/app/locales/de/translations.js index 9e90c58b..806688a7 100644 --- a/frontend/app/locales/de/translations.js +++ b/frontend/app/locales/de/translations.js @@ -57,8 +57,8 @@ export default { symonitoring: 'SyMonitoring', 'symonitoring.description': 'Überwachung von Server und Diensten', - sysupport: 'SySupport', - 'sysupport.description': 'Support Abonnemente', + timed: 'Credits / Reports', + 'timed.description': 'Support Abonnemente', ppa: 'PPA', 'ppa.description': 'Verwaltung ihrer Webhostings', @@ -74,7 +74,7 @@ export default { nav: { dashboard: 'Übersicht', vault: 'Vault', - sysupport: 'SySupport', + timed: 'Credits / Reports', gitlab: 'Projekte', settings: 'Einstellungen', logout: 'Logout' @@ -92,7 +92,7 @@ export default { 'Das Passwort konnte nicht in die Zwischenablage kopiert werden.' }, - sysupport: { + timed: { breadcrumbs: { reload: 'Aufladen', overview: 'Übersicht' @@ -120,7 +120,7 @@ export default { }, index: { - title: 'Sysupport Abonnements', + title: 'Abonnements', charge: 'Aufladen', details: 'Details' }, diff --git a/frontend/app/locales/en/translations.js b/frontend/app/locales/en/translations.js index f6d0f4ed..401ac795 100644 --- a/frontend/app/locales/en/translations.js +++ b/frontend/app/locales/en/translations.js @@ -57,8 +57,8 @@ export default { symonitoring: 'SyMonitoring', 'symonitoring.description': 'Monitoring of servers and services', - sysupport: 'SySupport', - 'sysupport.description': 'Support subscriptions', + timed: 'Credits / Reports', + 'timed.description': 'Support subscriptions', ppa: 'PPA', 'ppa.description': 'Manage your web-hostings', @@ -74,7 +74,7 @@ export default { nav: { dashboard: 'Dashboard', vault: 'Vault', - sysupport: 'SySupport', + timed: 'Credits / Reports', gitlab: 'Projects', settings: 'Settings', logout: 'Sign out' @@ -91,7 +91,7 @@ export default { 'clipboard-error': 'The secret could not be saved to your clipboard.' }, - sysupport: { + timed: { breadcrumbs: { reload: 'Reload', overview: 'Overview' @@ -118,7 +118,7 @@ export default { } }, index: { - title: 'Sysupport Subscriptions', + title: 'Credits / Reports', charge: 'Reload', details: 'Details' }, diff --git a/frontend/app/mixins/route-access-mixin.js b/frontend/app/mixins/route-access-mixin.js index a6b4387b..224a743a 100644 --- a/frontend/app/mixins/route-access-mixin.js +++ b/frontend/app/mixins/route-access-mixin.js @@ -12,8 +12,17 @@ export default Mixin.create({ }, _hasPermissions(user) { - return this.groups.every( - role => user.get(role) || user.get('groups').includes(role) + return ( + (this.groups.requireAll + ? this.groups.requireAll.every( + role => user.get(role) || user.get('groups').includes(role) + ) + : true) && + (this.groups.requireAll + ? this.groups.requireOne.some( + role => user.get(role) || user.get('groups').includes(role) + ) + : true) ) } }) diff --git a/frontend/app/models/user.js b/frontend/app/models/user.js index 024fba8c..dddbf561 100644 --- a/frontend/app/models/user.js +++ b/frontend/app/models/user.js @@ -29,8 +29,8 @@ export default Model.extend({ return this._checkGroup('vault') }), - sysupport: computed('groups.[]', function() { - return this._checkGroup('sysupport') + timed: computed('groups.[]', function() { + return this._checkGroup('timed') }), gitlab: computed('groups.[]', function() { @@ -64,6 +64,10 @@ export default Model.extend({ return this._checkGroup(ENV.APP.adminGroup) }), + adsyUser: computed('groups.[]', function() { + return this._checkGroup(ENV.APP.adsyUserGroup) + }), + _checkGroup(name) { return this.groups.find(g => g.endsWith(name)) } diff --git a/frontend/app/protected/template.hbs b/frontend/app/protected/template.hbs index 144c4a69..a222ccc5 100644 --- a/frontend/app/protected/template.hbs +++ b/frontend/app/protected/template.hbs @@ -35,18 +35,20 @@ {{#list.item 'gitlab'}}{{t 'nav.gitlab'}}{{/list.item}} {{/if}} - {{#if (and (service-enabled 'sysupport') model.sysupport)}} - {{#if model.admin}} - {{#list.item 'sysupport-admin' }}{{t 'nav.sysupport'}}{{/list.item}} - + {{#if (and (service-enabled 'timed') model.timed)}} + {{#if (or model.adsyUser model.admin)}} + {{#list.item 'timed-admin' }}{{t 'nav.timed'}}{{/list.item}} + {{#if model.admin}} + + {{/if}} {{else}} - {{#list.item 'sysupport-subscriptions' }}{{t 'nav.sysupport'}}{{/list.item}} + {{#list.item 'timed-subscriptions' }}{{t 'nav.timed'}}{{/list.item}} {{/if}} {{/if}} {{/nav.list}} diff --git a/frontend/app/router.js b/frontend/app/router.js index 8ba8cda4..ce351f92 100644 --- a/frontend/app/router.js +++ b/frontend/app/router.js @@ -18,12 +18,12 @@ Router.map(function() { this.route('vault', { resetNamespace: true }, function() { this.route('edit', { path: '/*path' }) }) - this.route('sysupport-subscriptions', { resetNamespace: true }, function() { + this.route('timed-subscriptions', { resetNamespace: true }, function() { this.route('detail', { path: ':project_id' }, function() { this.route('reload') }) }) - this.route('sysupport-admin', { resetNamespace: true }, function() { + this.route('timed-admin', { resetNamespace: true }, function() { this.route('detail', { path: ':project' }) this.route('confirm-subscriptions') }) diff --git a/frontend/app/sysupport-admin/confirm-subscriptions/route.js b/frontend/app/timed-admin/confirm-subscriptions/route.js similarity index 77% rename from frontend/app/sysupport-admin/confirm-subscriptions/route.js rename to frontend/app/timed-admin/confirm-subscriptions/route.js index 9c26904c..986103b5 100644 --- a/frontend/app/sysupport-admin/confirm-subscriptions/route.js +++ b/frontend/app/timed-admin/confirm-subscriptions/route.js @@ -8,7 +8,7 @@ export default Route.extend({ init() { this._super(...arguments) this.set('breadCrumb', { - title: this.i18n.t('sysupport.admin.confirm-subscription') + title: this.i18n.t('timed.admin.confirm-subscription') }) }, @@ -34,14 +34,14 @@ export default Route.extend({ order.confirm() order.unloadRecord() this.notify.info( - this.i18n.t('sysupport.admin.confirmSuccess', order.get('project.name')) + this.i18n.t('timed.admin.confirmSuccess', order.get('project.name')) ) }, _deny(order) { order.destroyRecord() this.notify.info( - this.i18n.t('sysupport.admin.confirmDeny', order.get('project.name')) + this.i18n.t('timed.admin.confirmDeny', order.get('project.name')) ) } }) diff --git a/frontend/app/sysupport-admin/confirm-subscriptions/template.hbs b/frontend/app/timed-admin/confirm-subscriptions/template.hbs similarity index 83% rename from frontend/app/sysupport-admin/confirm-subscriptions/template.hbs rename to frontend/app/timed-admin/confirm-subscriptions/template.hbs index 87053122..9c76d523 100644 --- a/frontend/app/sysupport-admin/confirm-subscriptions/template.hbs +++ b/frontend/app/timed-admin/confirm-subscriptions/template.hbs @@ -1,11 +1,11 @@ -

{{t 'sysupport.admin.confirm-subscription'}}

+

{{t 'timed.admin.confirm-subscription'}}

- - - - + + + + diff --git a/frontend/app/sysupport-admin/detail/controller.js b/frontend/app/timed-admin/detail/controller.js similarity index 89% rename from frontend/app/sysupport-admin/detail/controller.js rename to frontend/app/timed-admin/detail/controller.js index 783bbcc6..dbf1aadc 100644 --- a/frontend/app/sysupport-admin/detail/controller.js +++ b/frontend/app/timed-admin/detail/controller.js @@ -10,6 +10,7 @@ import UIkit from 'UIkit' export default Controller.extend({ i18n: service(), notify: service(), + session: service(), duration: computed('validation.{hour,minute}', 'hour', 'minute', function() { if (this.get('validation.hour') || this.get('validation.minute')) { @@ -27,6 +28,10 @@ export default Controller.extend({ ) }), + isAdmin: computed('session', async function() { + return await this.get('session.user').isAdmin + }), + orders: computed('fetchModels.lastSuccessful.value', function() { return ( this.get('fetchModels.lastSuccessful.value.orders') || @@ -82,7 +87,7 @@ export default Controller.extend({ ) }) } catch (e) { - this.notify.error(this.i18n.t('sysupport.reload.error-loading')) + this.notify.error(this.i18n.t('timed.reload.error-loading')) } }).drop(), @@ -95,11 +100,11 @@ export default Controller.extend({ }) yield order.save() - this.notify.success(this.i18n.t('sysupport.reload.success')) + this.notify.success(this.i18n.t('timed.reload.success')) UIkit.accordion('[data-reload-acc]').toggle() this.setProperties({ hour: null, minute: null }) } catch (e) { - this.notify.error(this.i18n.t('sysupport.reload.error')) + this.notify.error(this.i18n.t('timed.reload.error')) } finally { this.fetchModels.perform() this.set('preview', false) diff --git a/frontend/app/sysupport-admin/detail/route.js b/frontend/app/timed-admin/detail/route.js similarity index 100% rename from frontend/app/sysupport-admin/detail/route.js rename to frontend/app/timed-admin/detail/route.js diff --git a/frontend/app/sysupport-admin/detail/template.hbs b/frontend/app/timed-admin/detail/template.hbs similarity index 84% rename from frontend/app/sysupport-admin/detail/template.hbs rename to frontend/app/timed-admin/detail/template.hbs index cea0c75f..df26a044 100644 --- a/frontend/app/sysupport-admin/detail/template.hbs +++ b/frontend/app/timed-admin/detail/template.hbs @@ -1,11 +1,12 @@ +{{#if (get (await session.user) 'admin')}}

+{{/if}}
@@ -46,19 +48,19 @@
-
{{t 'sysupport.admin.customer'}}:
+
{{t 'timed.admin.customer'}}:
{{project.customer.name}}
-
{{t 'sysupport.admin.billingType'}}:
+
{{t 'timed.admin.billingType'}}:
{{project.billingType.name}}
-
{{t 'sysupport.time.total'}}:
+
{{t 'timed.time.total'}}:
{{format-duration (if (and duration preview) previewDuration project.totalTime) }}
-
{{t 'sysupport.time.unconfirmed'}}:
+
{{t 'timed.time.unconfirmed'}}:
{{format-duration project.unconfirmedTime}}
@@ -70,16 +72,16 @@ {{#uk-card as |card|}} {{#card.header}} {{#card.title}} - {{t 'sysupport.detail.charges'}} + {{t 'timed.detail.charges'}} {{/card.title}} {{/card.header}} {{#card.body}}
{{t 'sysupport.admin.customer'}}{{t 'sysupport.admin.project'}}{{t 'sysupport.hours'}}{{t 'sysupport.date'}}{{t 'timed.admin.customer'}}{{t 'timed.admin.project'}}{{t 'timed.hours'}}{{t 'timed.date'}}
- - - + + + @@ -106,17 +108,17 @@ {{#uk-card as |card|}} {{#card.header}} {{#card.title}} - {{t 'sysupport.detail.expense'}} + {{t 'timed.detail.expense'}} {{/card.title}} {{/card.header}} {{#card.body}}
{{t 'sysupport.date'}}{{t 'sysupport.detail.amount'}}{{t 'sysupport.detail.acknowledged'}}{{t 'timed.date'}}{{t 'timed.detail.amount'}}{{t 'timed.detail.acknowledged'}}
- - - - + + + + diff --git a/frontend/app/sysupport-admin/index/controller.js b/frontend/app/timed-admin/index/controller.js similarity index 78% rename from frontend/app/sysupport-admin/index/controller.js rename to frontend/app/timed-admin/index/controller.js index 0247ae48..f55f2f44 100644 --- a/frontend/app/sysupport-admin/index/controller.js +++ b/frontend/app/timed-admin/index/controller.js @@ -6,40 +6,40 @@ export default Controller.extend({ return [ { type: 'search', - title: 'sysupport.admin.project', + title: 'timed.admin.project', attr: 'name' }, { type: 'search', - title: 'sysupport.admin.customer', + title: 'timed.admin.customer', attr: 'customer.name' }, { type: 'search', - title: 'sysupport.admin.billingType', + title: 'timed.admin.billingType', attr: 'billingType.name' }, { type: 'sort', - title: 'sysupport.time.ordered', + title: 'timed.time.ordered', attr: 'purchasedTime', customFilter: this._sortDurations }, { type: 'sort', - title: 'sysupport.time.used', + title: 'timed.time.used', attr: 'spentTime', customFilter: this._sortDurations }, { type: 'sort', - title: 'sysupport.time.total', + title: 'timed.time.total', attr: 'totalTime', customFilter: this._sortDurations }, { type: 'sort', - title: 'sysupport.time.unconfirmed', + title: 'timed.time.unconfirmed', attr: 'unconfirmedTime', customFilter: this._sortDurations } diff --git a/frontend/app/sysupport-admin/index/route.js b/frontend/app/timed-admin/index/route.js similarity index 88% rename from frontend/app/sysupport-admin/index/route.js rename to frontend/app/timed-admin/index/route.js index 969ed3f3..fcae7b50 100644 --- a/frontend/app/sysupport-admin/index/route.js +++ b/frontend/app/timed-admin/index/route.js @@ -7,7 +7,7 @@ export default Route.extend({ init() { this._super(...arguments) this.set('breadCrumb', { - title: this.i18n.t('sysupport.admin.admin') + title: this.i18n.t('timed.admin.admin') }) }, diff --git a/frontend/app/sysupport-admin/index/template.hbs b/frontend/app/timed-admin/index/template.hbs similarity index 93% rename from frontend/app/sysupport-admin/index/template.hbs rename to frontend/app/timed-admin/index/template.hbs index 7a98d0c9..cc60d4c2 100644 --- a/frontend/app/sysupport-admin/index/template.hbs +++ b/frontend/app/timed-admin/index/template.hbs @@ -1,9 +1,9 @@ -

{{t 'sysupport.admin.projects'}}

+

{{t 'timed.admin.projects'}}

{{#cc-data-table headers=headers model=model as |results|}} {{#each results as |project index|}} - {{#link-to "sysupport-admin.detail" project.id + {{#link-to "timed-admin.detail" project.id data-test-project=index class=(concat "uk-link-reset pointer " (if project.isTimeAlmostConsumed "highlight-left")) diff --git a/frontend/app/sysupport-subscriptions/route.js b/frontend/app/timed-admin/route.js similarity index 66% rename from frontend/app/sysupport-subscriptions/route.js rename to frontend/app/timed-admin/route.js index 988289b1..b755280d 100644 --- a/frontend/app/sysupport-subscriptions/route.js +++ b/frontend/app/timed-admin/route.js @@ -3,5 +3,8 @@ import { computed } from '@ember/object' import RouteAccessMixin from 'customer-center/mixins/route-access-mixin' export default Route.extend(RouteAccessMixin, { - groups: computed(() => ['sysupport', 'adsy-customer']) + groups: computed(() => ({ + requireAll: ['timed'], + requireOne: ['adsy-user', 'adsy-admin'] + })) }) diff --git a/frontend/app/sysupport-admin/template.hbs b/frontend/app/timed-admin/template.hbs similarity index 100% rename from frontend/app/sysupport-admin/template.hbs rename to frontend/app/timed-admin/template.hbs diff --git a/frontend/app/sysupport-subscriptions/detail/index/route.js b/frontend/app/timed-subscriptions/detail/index/route.js similarity index 84% rename from frontend/app/sysupport-subscriptions/detail/index/route.js rename to frontend/app/timed-subscriptions/detail/index/route.js index cca715ad..aa79baf7 100644 --- a/frontend/app/sysupport-subscriptions/detail/index/route.js +++ b/frontend/app/timed-subscriptions/detail/index/route.js @@ -3,7 +3,7 @@ import { hash } from 'rsvp' export default Route.extend({ model() { - let project = this.modelFor('sysupport-subscriptions.detail').id + let project = this.modelFor('timed-subscriptions.detail').id return hash({ reports: this.store.query('timed-report', { project, diff --git a/frontend/app/sysupport-subscriptions/detail/index/template.hbs b/frontend/app/timed-subscriptions/detail/index/template.hbs similarity index 79% rename from frontend/app/sysupport-subscriptions/detail/index/template.hbs rename to frontend/app/timed-subscriptions/detail/index/template.hbs index 8132281a..8e2f444c 100644 --- a/frontend/app/sysupport-subscriptions/detail/index/template.hbs +++ b/frontend/app/timed-subscriptions/detail/index/template.hbs @@ -3,17 +3,17 @@ {{#uk-card as |card|}} {{#card.header}} {{#card.title}} - {{t 'sysupport.detail.expense'}} + {{t 'timed.detail.expense'}} {{/card.title}} {{/card.header}} {{#card.body}}
{{t 'sysupport.date'}}{{t 'sysupport.detail.effort'}}{{t 'sysupport.detail.employee'}}{{t 'sysupport.detail.description'}}{{t 'timed.date'}}{{t 'timed.detail.effort'}}{{t 'timed.detail.employee'}}{{t 'timed.detail.description'}}
- - - - + + + + @@ -34,16 +34,16 @@ {{#uk-card as |card|}} {{#card.header}} {{#card.title}} - {{t 'sysupport.detail.charges'}} + {{t 'timed.detail.charges'}} {{/card.title}} {{/card.header}} {{#card.body}}
{{t 'sysupport.date'}}{{t 'sysupport.detail.effort'}}{{t 'sysupport.detail.employee'}}{{t 'sysupport.detail.description'}}{{t 'timed.date'}}{{t 'timed.detail.effort'}}{{t 'timed.detail.employee'}}{{t 'timed.detail.description'}}
- - - + + + diff --git a/frontend/app/sysupport-subscriptions/detail/reload/controller.js b/frontend/app/timed-subscriptions/detail/reload/controller.js similarity index 78% rename from frontend/app/sysupport-subscriptions/detail/reload/controller.js rename to frontend/app/timed-subscriptions/detail/reload/controller.js index a024d53d..60af9403 100644 --- a/frontend/app/sysupport-subscriptions/detail/reload/controller.js +++ b/frontend/app/timed-subscriptions/detail/reload/controller.js @@ -14,14 +14,14 @@ export default Controller.extend({ .createRecord('timed-subscription-order', order) .save() .then(() => { - this.notify.success(this.i18n.t('sysupport.reload.success')) + this.notify.success(this.i18n.t('timed.reload.success')) this.transitionToRoute( - 'sysupport-subscriptions.detail.index', + 'timed-subscriptions.detail.index', this.get('model.project') ) }) .catch(() => { - this.notify.error(this.i18n.t('sysupport.reload.error')) + this.notify.error(this.i18n.t('timed.reload.error')) }) }, diff --git a/frontend/app/sysupport-subscriptions/detail/reload/route.js b/frontend/app/timed-subscriptions/detail/reload/route.js similarity index 77% rename from frontend/app/sysupport-subscriptions/detail/reload/route.js rename to frontend/app/timed-subscriptions/detail/reload/route.js index a8de45be..6b716b55 100644 --- a/frontend/app/sysupport-subscriptions/detail/reload/route.js +++ b/frontend/app/timed-subscriptions/detail/reload/route.js @@ -8,12 +8,12 @@ export default Route.extend({ init() { this._super(...arguments) this.set('breadCrumb', { - title: this.i18n.t('sysupport.breadcrumbs.reload') + title: this.i18n.t('timed.breadcrumbs.reload') }) }, async model() { - let project = await this.modelFor('sysupport-subscriptions.detail') + let project = await this.modelFor('timed-subscriptions.detail') return RSVP.hash({ project, packages: this.store.findAll('timed-subscription-package', { diff --git a/frontend/app/sysupport-subscriptions/detail/reload/template.hbs b/frontend/app/timed-subscriptions/detail/reload/template.hbs similarity index 90% rename from frontend/app/sysupport-subscriptions/detail/reload/template.hbs rename to frontend/app/timed-subscriptions/detail/reload/template.hbs index 4eaa3621..7fc5630f 100644 --- a/frontend/app/sysupport-subscriptions/detail/reload/template.hbs +++ b/frontend/app/timed-subscriptions/detail/reload/template.hbs @@ -1,4 +1,4 @@ -

{{t 'sysupport.reload.select'}}

+

{{t 'timed.reload.select'}}

{{#each model.packages as |package index|}}
{{t 'sysupport.date'}}{{t 'sysupport.detail.amount'}}{{t 'sysupport.detail.acknowledged'}}{{t 'timed.date'}}{{t 'timed.detail.amount'}}{{t 'timed.detail.acknowledged'}}