Merge branch 'main' into feature-scope-capabilities
This commit is contained in:
25 files changed
+765
-169
No files matched your search
@@ -57,7 +57,7 @@ export default class BaseModel extends Model {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience for getting and setting the parent scope ID.
|
* Convenience for getting and setting the parent scope ID.
|
||||||
* @type {string
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
@computed('scope.scope_id')
|
@computed('scope.scope_id')
|
||||||
get scopeID() {
|
get scopeID() {
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ export default factory.extend({
|
|||||||
authorized_collection_actions: () => {
|
authorized_collection_actions: () => {
|
||||||
return {
|
return {
|
||||||
users: ['create', 'list'],
|
users: ['create', 'list'],
|
||||||
// groups: ['create', 'list'],
|
sessions: ['list'],
|
||||||
// roles: ['create', 'list'],
|
groups: ['create', 'list'],
|
||||||
// 'auth-methods': ['create', 'list'],
|
roles: ['create', 'list'],
|
||||||
// sessopms: ['list'],
|
'auth-methods': ['create', 'list'],
|
||||||
// targets: ['create', 'list'],
|
// targets: ['create', 'list'],
|
||||||
// 'host-catalogs': ['create', 'list'],
|
'host-catalogs': ['create', 'list'],
|
||||||
// 'credential-stores': ['create', 'list'],
|
// 'credential-stores': ['create', 'list'],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
|||||||
@service intl;
|
@service intl;
|
||||||
@service notify;
|
@service notify;
|
||||||
@service session;
|
@service session;
|
||||||
|
@service can;
|
||||||
|
|
||||||
// =methods
|
// =methods
|
||||||
|
|
||||||
@@ -26,8 +27,13 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
|||||||
* @return {Promise[AuthMethodModel]}
|
* @return {Promise[AuthMethodModel]}
|
||||||
*/
|
*/
|
||||||
async model() {
|
async model() {
|
||||||
const { id: scope_id } = this.modelFor('scopes.scope');
|
const scope = this.modelFor('scopes.scope');
|
||||||
return this.store.query('auth-method', { scope_id });
|
const { id: scope_id } = scope;
|
||||||
|
if (
|
||||||
|
this.can.can('list collection', scope, { collection: 'auth-methods' })
|
||||||
|
) {
|
||||||
|
return this.store.query('auth-method', { scope_id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =actions
|
// =actions
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default class ScopesScopeGroupsRoute extends Route {
|
|||||||
@service intl;
|
@service intl;
|
||||||
@service notify;
|
@service notify;
|
||||||
@service session;
|
@service session;
|
||||||
|
@service can;
|
||||||
// =methods
|
// =methods
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,8 +26,11 @@ export default class ScopesScopeGroupsRoute extends Route {
|
|||||||
* @return {Promise[GroupModel]}
|
* @return {Promise[GroupModel]}
|
||||||
*/
|
*/
|
||||||
async model() {
|
async model() {
|
||||||
const { id: scope_id } = this.modelFor('scopes.scope');
|
const scope = this.modelFor('scopes.scope');
|
||||||
return this.store.query('group', { scope_id });
|
const { id: scope_id } = scope;
|
||||||
|
if (this.can.can('list collection', scope, { collection: 'groups' })) {
|
||||||
|
return this.store.query('group', { scope_id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =actions
|
// =actions
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
export default class ScopesScopeGroupsIndexRoute extends Route {
|
||||||
|
// =methods
|
||||||
|
|
||||||
export default class ScopesScopeGroupsIndexRoute extends Route {}
|
setupController(controller) {
|
||||||
|
const scope = this.modelFor('scopes.scope');
|
||||||
|
super.setupController(...arguments);
|
||||||
|
controller.setProperties({ scope });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
|||||||
@service intl;
|
@service intl;
|
||||||
@service notify;
|
@service notify;
|
||||||
@service session;
|
@service session;
|
||||||
|
@service can;
|
||||||
// =methods
|
// =methods
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,8 +26,13 @@ export default class ScopesScopeHostCatalogsRoute extends Route {
|
|||||||
* @return {Promise{[HostCatalogModel]}}
|
* @return {Promise{[HostCatalogModel]}}
|
||||||
*/
|
*/
|
||||||
async model() {
|
async model() {
|
||||||
const { id: scope_id } = this.modelFor('scopes.scope');
|
const scope = this.modelFor('scopes.scope');
|
||||||
return this.store.query('host-catalog', { scope_id });
|
const { id: scope_id } = scope;
|
||||||
|
if (
|
||||||
|
this.can.can('list collection', scope, { collection: 'host-catalogs' })
|
||||||
|
) {
|
||||||
|
return this.store.query('host-catalog', { scope_id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =actions
|
// =actions
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default class ScopesScopeHostCatalogsIndexRoute extends Route {}
|
export default class ScopesScopeHostCatalogsIndexRoute extends Route {
|
||||||
|
setupController(controller) {
|
||||||
|
const scope = this.modelFor('scopes.scope');
|
||||||
|
super.setupController(...arguments);
|
||||||
|
controller.setProperties({ scope });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
|||||||
@service intl;
|
@service intl;
|
||||||
@service notify;
|
@service notify;
|
||||||
@service session;
|
@service session;
|
||||||
|
@service can;
|
||||||
|
|
||||||
// =methods
|
// =methods
|
||||||
|
|
||||||
@@ -26,8 +27,11 @@ export default class ScopesScopeRolesRoute extends Route {
|
|||||||
* @return {Promise{[RoleModel]}}
|
* @return {Promise{[RoleModel]}}
|
||||||
*/
|
*/
|
||||||
async model() {
|
async model() {
|
||||||
const { id: scope_id } = this.modelFor('scopes.scope');
|
const scope = this.modelFor('scopes.scope');
|
||||||
return this.store.query('role', { scope_id });
|
const { id: scope_id } = scope;
|
||||||
|
if (this.can.can('list collection', scope, { collection: 'roles' })) {
|
||||||
|
return this.store.query('role', { scope_id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =actions
|
// =actions
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
export default class ScopesScopeRolesIndexRoute extends Route {
|
||||||
|
// =methods
|
||||||
|
|
||||||
export default class ScopesScopeRolesIndexRoute extends Route {}
|
setupController(controller) {
|
||||||
|
const scope = this.modelFor('scopes.scope');
|
||||||
|
super.setupController(...arguments);
|
||||||
|
controller.setProperties({ scope });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,18 +71,22 @@
|
|||||||
</Rose::Nav::Sidebar>
|
</Rose::Nav::Sidebar>
|
||||||
--}}
|
--}}
|
||||||
<Rose::Nav::Sidebar @title={{t 'titles.resources'}} as |nav|>
|
<Rose::Nav::Sidebar @title={{t 'titles.resources'}} as |nav|>
|
||||||
<nav.link @route='scopes.scope.sessions'>
|
{{#if (can 'navigate collection' @model collection='sessions')}}
|
||||||
<Rose::Icon @name='flight-icons/entry-point-16' @size='medium' />
|
<nav.link @route='scopes.scope.sessions'>
|
||||||
{{t 'resources.session.title_plural'}}
|
<Rose::Icon @name='app-icons/action-session' @size='medium' />
|
||||||
</nav.link>
|
{{t 'resources.session.title_plural'}}
|
||||||
|
</nav.link>
|
||||||
|
{{/if}}
|
||||||
<nav.link @route='scopes.scope.targets'>
|
<nav.link @route='scopes.scope.targets'>
|
||||||
<Rose::Icon @name='flight-icons/crosshair-16' @size='medium' />
|
<Rose::Icon @name='flight-icons/crosshair-16' @size='medium' />
|
||||||
{{t 'resources.target.title_plural'}}
|
{{t 'resources.target.title_plural'}}
|
||||||
</nav.link>
|
</nav.link>
|
||||||
<nav.link @route='scopes.scope.host-catalogs'>
|
{{#if (can 'navigate collection' @model collection='host-catalogs')}}
|
||||||
<Rose::Icon @name='flight-icons/collections-16' @size='medium' />
|
<nav.link @route='scopes.scope.host-catalogs'>
|
||||||
{{t 'resources.host-catalog.title_plural'}}
|
<Rose::Icon @name='flight-icons/collections-16' @size='medium' />
|
||||||
</nav.link>
|
{{t 'resources.host-catalog.title_plural'}}
|
||||||
|
</nav.link>
|
||||||
|
{{/if}}
|
||||||
{{#if (feature-flag 'credential-store')}}
|
{{#if (feature-flag 'credential-store')}}
|
||||||
<nav.link @route='scopes.scope.credential-stores'>
|
<nav.link @route='scopes.scope.credential-stores'>
|
||||||
<Rose::Icon @name='flight-icons/key-16' @size='medium' />
|
<Rose::Icon @name='flight-icons/key-16' @size='medium' />
|
||||||
@@ -100,18 +104,27 @@
|
|||||||
{{t 'resources.user.title_plural'}}
|
{{t 'resources.user.title_plural'}}
|
||||||
</nav.link>
|
</nav.link>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<nav.link @route='scopes.scope.groups'>
|
{{#if (can 'navigate collection' @model collection='groups')}}
|
||||||
<Rose::Icon @name='flight-icons/folder-users-16' @size='medium' />
|
<nav.link @route='scopes.scope.groups'>
|
||||||
{{t 'resources.group.title_plural'}}
|
<Rose::Icon @name='flight-icons/folder-users-16' @size='medium' />
|
||||||
</nav.link>
|
{{t 'resources.group.title_plural'}}
|
||||||
<nav.link @route='scopes.scope.roles'>
|
</nav.link>
|
||||||
<Rose::Icon @name='flight-icons/identity-user-16' @size='medium' />
|
{{/if}}
|
||||||
{{t 'resources.role.title_plural'}}
|
{{#if (can 'navigate collection' @model collection='roles')}}
|
||||||
</nav.link>
|
<nav.link @route='scopes.scope.roles'>
|
||||||
<nav.link @route='scopes.scope.auth-methods'>
|
<Rose::Icon
|
||||||
<Rose::Icon @name='flight-icons/lock-16' @size='medium' />
|
@name='flight-icons/identity-user-16'
|
||||||
{{t 'resources.auth-method.title_plural'}}
|
@size='medium'
|
||||||
</nav.link>
|
/>
|
||||||
|
{{t 'resources.role.title_plural'}}
|
||||||
|
</nav.link>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (can 'navigate collection' @model collection='auth-methods')}}
|
||||||
|
<nav.link @route='scopes.scope.auth-methods'>
|
||||||
|
<Rose::Icon @name='flight-icons/lock-16' @size='medium' />
|
||||||
|
{{t 'resources.auth-method.title_plural'}}
|
||||||
|
</nav.link>
|
||||||
|
{{/if}}
|
||||||
</Rose::Nav::Sidebar>
|
</Rose::Nav::Sidebar>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
|
|||||||
@@ -12,25 +12,28 @@
|
|||||||
</page.breadcrumbs>
|
</page.breadcrumbs>
|
||||||
|
|
||||||
<page.actions>
|
<page.actions>
|
||||||
{{#if @model}}
|
|
||||||
<Rose::Dropdown
|
{{#if (can 'create collection' this.scopeModel collection='auth-methods')}}
|
||||||
@text={{t 'titles.new'}}
|
{{#if @model}}
|
||||||
@dropdownRight={{true}}
|
<Rose::Dropdown
|
||||||
as |dropdown|
|
@text={{t 'titles.new'}}
|
||||||
>
|
@dropdownRight={{true}}
|
||||||
<dropdown.link
|
as |dropdown|
|
||||||
@route='scopes.scope.auth-methods.new'
|
|
||||||
@query={{hash type='password'}}
|
|
||||||
>
|
>
|
||||||
{{t 'resources.auth-method.types.password'}}
|
<dropdown.link
|
||||||
</dropdown.link>
|
@route='scopes.scope.auth-methods.new'
|
||||||
<dropdown.link
|
@query={{hash type='password'}}
|
||||||
@route='scopes.scope.auth-methods.new'
|
>
|
||||||
@query={{hash type='oidc'}}
|
{{t 'resources.auth-method.types.password'}}
|
||||||
>
|
</dropdown.link>
|
||||||
{{t 'resources.auth-method.types.oidc'}}
|
<dropdown.link
|
||||||
</dropdown.link>
|
@route='scopes.scope.auth-methods.new'
|
||||||
</Rose::Dropdown>
|
@query={{hash type='oidc'}}
|
||||||
|
>
|
||||||
|
{{t 'resources.auth-method.types.oidc'}}
|
||||||
|
</dropdown.link>
|
||||||
|
</Rose::Dropdown>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</page.actions>
|
</page.actions>
|
||||||
|
|
||||||
@@ -165,7 +168,24 @@
|
|||||||
as |message|
|
as |message|
|
||||||
>
|
>
|
||||||
<message.description>
|
<message.description>
|
||||||
{{t 'resources.auth-method.messages.welcome.description'}}
|
{{#if (can 'list collection' this.scope collection='auth-methods')}}
|
||||||
|
{{! can list (at least): show default welcome message}}
|
||||||
|
{{t 'resources.auth-method.messages.welcome.description'}}
|
||||||
|
{{else if (can
|
||||||
|
'create collection' this.scope collection='auth-methods'
|
||||||
|
)}}
|
||||||
|
{{! can create (only): show create-but-not-list welcome message}}
|
||||||
|
{{t
|
||||||
|
'descriptions.create-but-not-list'
|
||||||
|
resource=(t 'resources.auth-method.title_plural')
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{! can neither list nor create }}
|
||||||
|
{{t
|
||||||
|
'descriptions.neither-list-nor-create'
|
||||||
|
resource=(t 'resources.auth-method.title_plural')
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
</message.description>
|
</message.description>
|
||||||
<message.link
|
<message.link
|
||||||
@route='scopes.scope.auth-methods.new'
|
@route='scopes.scope.auth-methods.new'
|
||||||
@@ -174,6 +194,12 @@
|
|||||||
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
||||||
{{t 'titles.new'}}
|
{{t 'titles.new'}}
|
||||||
</message.link>
|
</message.link>
|
||||||
|
{{#if (can 'create collection' this.scope collection='auth-methods')}}
|
||||||
|
<message.link @route='scopes.scope.auth-method.new'>
|
||||||
|
<Rose::Icon @name='plus-circle-outline' />
|
||||||
|
{{t 'titles.new'}}
|
||||||
|
</message.link>
|
||||||
|
{{/if}}
|
||||||
</Rose::Message>
|
</Rose::Message>
|
||||||
</Rose::Layout::Centered>
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,12 @@
|
|||||||
</page.header>
|
</page.header>
|
||||||
|
|
||||||
<page.actions>
|
<page.actions>
|
||||||
{{#if @model}}
|
{{#if (can 'create collection' this.scope collection='groups')}}
|
||||||
<Rose::LinkButton @route='scopes.scope.groups.new' @style='primary'>{{t
|
{{#if @model}}
|
||||||
'titles.new'
|
<Rose::LinkButton @route='scopes.scope.groups.new' @style='primary'>{{t
|
||||||
}}</Rose::LinkButton>
|
'titles.new'
|
||||||
|
}}</Rose::LinkButton>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</page.actions>
|
</page.actions>
|
||||||
|
|
||||||
@@ -70,11 +72,29 @@
|
|||||||
>
|
>
|
||||||
<message.description>
|
<message.description>
|
||||||
{{t 'resources.group.description'}}
|
{{t 'resources.group.description'}}
|
||||||
|
{{#if (can 'list collection' this.scope collection='groups')}}
|
||||||
|
{{! can list (at least): show default welcome message}}
|
||||||
|
{{t 'resources.group.description'}}
|
||||||
|
{{else if (can 'create collection' this.scope collection='groups')}}
|
||||||
|
{{! can create (only): show create-but-not-list welcome message}}
|
||||||
|
{{t
|
||||||
|
'descriptions.create-but-not-list'
|
||||||
|
resource=(t 'resources.group.title_plural')
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{! can neither list nor create }}
|
||||||
|
{{t
|
||||||
|
'descriptions.neither-list-nor-create'
|
||||||
|
resource=(t 'resources.group.title_plural')
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
</message.description>
|
</message.description>
|
||||||
<message.link @route='scopes.scope.groups.new'>
|
{{#if (can 'create collection' this.scope collection='groups')}}
|
||||||
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
<message.link @route='scopes.scope.groups.new'>
|
||||||
{{t 'titles.new'}}
|
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
||||||
</message.link>
|
{{t 'titles.new'}}
|
||||||
|
</message.link>
|
||||||
|
{{/if}}
|
||||||
</Rose::Message>
|
</Rose::Message>
|
||||||
</Rose::Layout::Centered>
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,15 @@
|
|||||||
</page.header>
|
</page.header>
|
||||||
|
|
||||||
<page.actions>
|
<page.actions>
|
||||||
{{#if @model}}
|
{{#if (can 'create collection' this.scope collection='host-catalogs')}}
|
||||||
<Rose::LinkButton
|
{{#if @model}}
|
||||||
@route='scopes.scope.host-catalogs.new'
|
<Rose::LinkButton
|
||||||
@style='primary'
|
@route='scopes.scope.host-catalogs.new'
|
||||||
>
|
@style='primary'
|
||||||
{{t 'titles.new'}}
|
>
|
||||||
</Rose::LinkButton>
|
{{t 'titles.new'}}
|
||||||
|
</Rose::LinkButton>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</page.actions>
|
</page.actions>
|
||||||
|
|
||||||
@@ -82,12 +84,35 @@
|
|||||||
as |message|
|
as |message|
|
||||||
>
|
>
|
||||||
<message.description>
|
<message.description>
|
||||||
{{t 'resources.host-catalog.description'}}
|
{{#if
|
||||||
|
(can 'list collection' this.scope collection='host-catalogs')
|
||||||
|
}}
|
||||||
|
{{! can list (at least): show default welcome message}}
|
||||||
|
{{t 'resources.host-catalog.description'}}
|
||||||
|
{{else if (can
|
||||||
|
'create collection' this.scope collection='host-catalogs'
|
||||||
|
)}}
|
||||||
|
{{! can create (only): show create-but-not-list welcome message}}
|
||||||
|
{{t
|
||||||
|
'descriptions.create-but-not-list'
|
||||||
|
resource=(t 'resources.host-catalog.title_plural')
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{! can neither list nor create }}
|
||||||
|
{{t
|
||||||
|
'descriptions.neither-list-nor-create'
|
||||||
|
resource=(t 'resources.host-catalog.title_plural')
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
</message.description>
|
</message.description>
|
||||||
<message.link @route='scopes.scope.host-catalogs.new'>
|
{{#if
|
||||||
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
(can 'create collection' this.scope collection='host-catalogs')
|
||||||
{{t 'titles.new'}}
|
}}
|
||||||
</message.link>
|
<message.link @route='scopes.scope.host-catalogs.new'>
|
||||||
|
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
||||||
|
{{t 'titles.new'}}
|
||||||
|
</message.link>
|
||||||
|
{{/if}}
|
||||||
</Rose::Message>
|
</Rose::Message>
|
||||||
</Rose::Layout::Centered>
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,12 @@
|
|||||||
</page.header>
|
</page.header>
|
||||||
|
|
||||||
<page.actions>
|
<page.actions>
|
||||||
{{#if @model}}
|
{{#if (can 'create collection' this.scope collection='roles')}}
|
||||||
<Rose::LinkButton @route='scopes.scope.roles.new' @style='primary'>{{t
|
{{#if @model}}
|
||||||
'titles.new'
|
<Rose::LinkButton @route='scopes.scope.roles.new' @style='primary'>{{t
|
||||||
}}</Rose::LinkButton>
|
'titles.new'
|
||||||
|
}}</Rose::LinkButton>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</page.actions>
|
</page.actions>
|
||||||
|
|
||||||
@@ -68,12 +70,29 @@
|
|||||||
as |message|
|
as |message|
|
||||||
>
|
>
|
||||||
<message.description>
|
<message.description>
|
||||||
{{t 'resources.role.description'}}
|
{{#if (can 'list collection' this.scope collection='roles')}}
|
||||||
|
{{! can list (at least): show default welcome message}}
|
||||||
|
{{t 'resources.roles.description'}}
|
||||||
|
{{else if (can 'create collection' this.scope collection='roles')}}
|
||||||
|
{{! can create (only): show create-but-not-list welcome message}}
|
||||||
|
{{t
|
||||||
|
'descriptions.create-but-not-list'
|
||||||
|
resource=(t 'resources.role.title_plural')
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{! can neither list nor create }}
|
||||||
|
{{t
|
||||||
|
'descriptions.neither-list-nor-create'
|
||||||
|
resource=(t 'resources.role.title_plural')
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
</message.description>
|
</message.description>
|
||||||
<message.link @route='scopes.scope.roles.new'>
|
{{#if (can 'create collection' this.scope collection='roles')}}
|
||||||
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
<message.link @route='scopes.scope.roles.new'>
|
||||||
{{t 'titles.new'}}
|
<Rose::Icon @name='flight-icons/plus-circle-16' />
|
||||||
</message.link>
|
{{t 'titles.new'}}
|
||||||
|
</message.link>
|
||||||
|
{{/if}}
|
||||||
</Rose::Message>
|
</Rose::Message>
|
||||||
</Rose::Layout::Centered>
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
|
|||||||
+58
-54
@@ -2,7 +2,6 @@ import { module, test } from 'qunit';
|
|||||||
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
|
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
|
||||||
import { setupApplicationTest } from 'ember-qunit';
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
|
||||||
import { Response } from 'miragejs';
|
import { Response } from 'miragejs';
|
||||||
import {
|
import {
|
||||||
authenticateSession,
|
authenticateSession,
|
||||||
@@ -12,7 +11,7 @@ import {
|
|||||||
} from 'ember-simple-auth/test-support';
|
} from 'ember-simple-auth/test-support';
|
||||||
import { enableFeature } from 'ember-feature-flags/test-support';
|
import { enableFeature } from 'ember-feature-flags/test-support';
|
||||||
|
|
||||||
module('Acceptance | auth methods', function (hooks) {
|
module('Acceptance | auth-methods | create ', function (hooks) {
|
||||||
setupApplicationTest(hooks);
|
setupApplicationTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
|
||||||
@@ -20,9 +19,12 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
scopes: {
|
scopes: {
|
||||||
global: null,
|
global: null,
|
||||||
org: null,
|
org: null,
|
||||||
|
project: null,
|
||||||
},
|
},
|
||||||
authMethod: null,
|
authMethod: null,
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const urls = {
|
const urls = {
|
||||||
orgScope: null,
|
orgScope: null,
|
||||||
authMethods: null,
|
authMethods: null,
|
||||||
@@ -31,58 +33,33 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
// Setup Mirage mock resources for this test
|
|
||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
instances.orgScope = this.server.create(
|
||||||
instances.scopes.org = this.server.create('scope', {
|
'scope',
|
||||||
type: 'org',
|
{
|
||||||
scope: { id: 'global', type: 'global' },
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
|
||||||
|
instances.scopes.project = this.server.create('scope', {
|
||||||
|
type: 'project',
|
||||||
|
scope: { id: instances.orgScope.id, type: instances.orgScope.type },
|
||||||
});
|
});
|
||||||
|
|
||||||
instances.authMethod = this.server.create('auth-method', {
|
instances.authMethod = this.server.create('auth-method', {
|
||||||
scope: instances.scopes.org,
|
scope: instances.orgScope,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate route URLs for resources
|
// Generate route URLs for resources
|
||||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
urls.orgScope = `/scopes/${instances.orgScope.id}`;
|
||||||
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
urls.authMethods = `${urls.orgScope}/auth-methods`;
|
||||||
urls.newAuthMethod = `${urls.authMethods}/new?type=password`;
|
urls.newAuthMethod = `${urls.authMethods}/new?type=password`;
|
||||||
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
|
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('visiting auth methods', async function (assert) {
|
test('Users can create new auth method', async function (assert) {
|
||||||
assert.expect(1);
|
|
||||||
await visit(urls.authMethods);
|
|
||||||
await a11yAudit();
|
|
||||||
assert.equal(currentURL(), urls.authMethods);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('can navigate to an auth method form', async function (assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
await visit(urls.authMethods);
|
|
||||||
await click('main tbody .rose-table-header-cell:nth-child(1) a');
|
|
||||||
await a11yAudit();
|
|
||||||
assert.equal(currentURL(), urls.authMethod);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('can update an auth method and save changes', async function (assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
await visit(urls.authMethod);
|
|
||||||
await click('form [type="button"]', 'Activate edit mode');
|
|
||||||
await fillIn('[name="name"]', 'update name');
|
|
||||||
await click('form [type="submit"]:not(:disabled)');
|
|
||||||
assert.equal(this.server.db.authMethods[0].name, 'update name');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('can update an auth method and cancel changes', async function (assert) {
|
|
||||||
assert.expect(1);
|
|
||||||
await visit(urls.authMethod);
|
|
||||||
await click('form [type="button"]', 'Activate edit mode');
|
|
||||||
await fillIn('[name="name"]', 'update name');
|
|
||||||
await click('form button:not([type="submit"])');
|
|
||||||
assert.notEqual(this.server.db.authMethods[0].name, 'update name');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('can create new auth method', async function (assert) {
|
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
const authMethodsCount = this.server.db.authMethods.length;
|
const authMethodsCount = this.server.db.authMethods.length;
|
||||||
await visit(urls.newAuthMethod);
|
await visit(urls.newAuthMethod);
|
||||||
@@ -92,6 +69,33 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
assert.equal(this.server.db.authMethods.length, authMethodsCount + 1);
|
assert.equal(this.server.db.authMethods.length, authMethodsCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to new auth-methods route with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'] = [
|
||||||
|
'create',
|
||||||
|
'list',
|
||||||
|
];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
|
||||||
|
'create'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.authMethods}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to new auth-methods route without proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'] = [];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
|
||||||
|
'create'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.authMethods}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
test('can cancel new auth method creation', async function (assert) {
|
test('can cancel new auth method creation', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const authMethodsCount = this.server.db.authMethods.length;
|
const authMethodsCount = this.server.db.authMethods.length;
|
||||||
@@ -106,7 +110,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
test('user can make primary an auth method', async function (assert) {
|
test('user can make primary an auth method', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
instances.scopes.org.primaryAuthMethodId,
|
instances.orgScope.primaryAuthMethodId,
|
||||||
'Primary auth method is not yet set.'
|
'Primary auth method is not yet set.'
|
||||||
);
|
);
|
||||||
enableFeature('primary-auth-method');
|
enableFeature('primary-auth-method');
|
||||||
@@ -114,7 +118,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
await click(
|
await click(
|
||||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||||
);
|
);
|
||||||
const scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
const scope = this.server.schema.scopes.find(instances.orgScope.id);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
scope.primaryAuthMethodId,
|
scope.primaryAuthMethodId,
|
||||||
instances.authMethod.id,
|
instances.authMethod.id,
|
||||||
@@ -136,7 +140,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
instances.scopes.org.primaryAuthMethodId,
|
instances.orgScope.primaryAuthMethodId,
|
||||||
'Primary auth method is not yet set.'
|
'Primary auth method is not yet set.'
|
||||||
);
|
);
|
||||||
enableFeature('primary-auth-method');
|
enableFeature('primary-auth-method');
|
||||||
@@ -149,11 +153,11 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
|
|
||||||
test('user can remove as primary an auth method', async function (assert) {
|
test('user can remove as primary an auth method', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
instances.scopes.org.update({
|
instances.orgScope.update({
|
||||||
primaryAuthMethodId: instances.authMethod.id,
|
primaryAuthMethodId: instances.authMethod.id,
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
instances.scopes.org.primaryAuthMethodId,
|
instances.orgScope.primaryAuthMethodId,
|
||||||
'Primary auth method is set.'
|
'Primary auth method is set.'
|
||||||
);
|
);
|
||||||
enableFeature('primary-auth-method');
|
enableFeature('primary-auth-method');
|
||||||
@@ -161,7 +165,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
await click(
|
await click(
|
||||||
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
'.rose-layout-page-actions .rose-dropdown-content [type="button"]:first-child'
|
||||||
);
|
);
|
||||||
const scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
const scope = this.server.schema.scopes.find(instances.orgScope.id);
|
||||||
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -178,11 +182,11 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
instances.scopes.org.update({
|
instances.orgScope.update({
|
||||||
primaryAuthMethodId: instances.authMethod.id,
|
primaryAuthMethodId: instances.authMethod.id,
|
||||||
});
|
});
|
||||||
assert.ok(
|
assert.ok(
|
||||||
instances.scopes.org.primaryAuthMethodId,
|
instances.orgScope.primaryAuthMethodId,
|
||||||
'Primary auth method is set.'
|
'Primary auth method is set.'
|
||||||
);
|
);
|
||||||
enableFeature('primary-auth-method');
|
enableFeature('primary-auth-method');
|
||||||
@@ -196,7 +200,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
test('user can make and remove primary auth methods from index', async function (assert) {
|
test('user can make and remove primary auth methods from index', async function (assert) {
|
||||||
assert.expect(3);
|
assert.expect(3);
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
instances.scopes.org.primaryAuthMethodId,
|
instances.orgScope.primaryAuthMethodId,
|
||||||
'Primary auth method is not yet set.'
|
'Primary auth method is not yet set.'
|
||||||
);
|
);
|
||||||
enableFeature('primary-auth-method');
|
enableFeature('primary-auth-method');
|
||||||
@@ -204,7 +208,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
await click(
|
await click(
|
||||||
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
||||||
);
|
);
|
||||||
let scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
let scope = this.server.schema.scopes.find(instances.orgScope.id);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
scope.primaryAuthMethodId,
|
scope.primaryAuthMethodId,
|
||||||
instances.authMethod.id,
|
instances.authMethod.id,
|
||||||
@@ -213,7 +217,7 @@ module('Acceptance | auth methods', function (hooks) {
|
|||||||
await click(
|
await click(
|
||||||
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
'.rose-table-body .rose-table-row:first-child .rose-dropdown-content [type="button"]:first-child'
|
||||||
);
|
);
|
||||||
scope = this.server.schema.scopes.find(instances.scopes.org.id);
|
scope = this.server.schema.scopes.find(instances.orgScope.id);
|
||||||
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { visit, find } from '@ember/test-helpers';
|
||||||
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
|
import {
|
||||||
|
authenticateSession,
|
||||||
|
// These are left here intentionally for future reference.
|
||||||
|
//currentSession,
|
||||||
|
//invalidateSession,
|
||||||
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
|
module('Acceptance | auth-methods | list', function (hooks) {
|
||||||
|
setupApplicationTest(hooks);
|
||||||
|
setupMirage(hooks);
|
||||||
|
|
||||||
|
const instances = {
|
||||||
|
scopes: {
|
||||||
|
global: null,
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const urls = {
|
||||||
|
scopes: {
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
authMethods: null,
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
hooks.beforeEach(function () {
|
||||||
|
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
|
||||||
|
urls.orgScope = `/scopes/${instances.orgScope.id}`;
|
||||||
|
urls.authMethods = `/scopes/${instances.orgScope.id}/auth-methods`;
|
||||||
|
authenticateSession({});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to auth methods with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
|
||||||
|
'list'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.authMethods}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to index without either list or create actions', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'] = [];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
|
||||||
|
'list'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.authMethods}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('User can navigate to index with only create action', async function (assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
instances.orgScope.authorized_collection_actions['auth-methods'] = [
|
||||||
|
'create',
|
||||||
|
];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(find(`[href="${urls.authMethods}"]`));
|
||||||
|
});
|
||||||
|
});
|
||||||
+32
-9
@@ -10,9 +10,10 @@ import {
|
|||||||
//invalidateSession,
|
//invalidateSession,
|
||||||
} from 'ember-simple-auth/test-support';
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
module('Acceptance | groups', function (hooks) {
|
module('Acceptance | groups | create', function (hooks) {
|
||||||
setupApplicationTest(hooks);
|
setupApplicationTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
let orgURL;
|
||||||
|
|
||||||
const instances = {
|
const instances = {
|
||||||
scopes: {
|
scopes: {
|
||||||
@@ -20,9 +21,9 @@ module('Acceptance | groups', function (hooks) {
|
|||||||
org: null,
|
org: null,
|
||||||
},
|
},
|
||||||
group: null,
|
group: null,
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
const urls = {
|
const urls = {
|
||||||
orgScope: null,
|
|
||||||
groups: null,
|
groups: null,
|
||||||
group: null,
|
group: null,
|
||||||
newGroup: null,
|
newGroup: null,
|
||||||
@@ -30,17 +31,21 @@ module('Acceptance | groups', function (hooks) {
|
|||||||
|
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
instances.orgScope = this.server.create(
|
||||||
instances.scopes.org = this.server.create('scope', {
|
'scope',
|
||||||
type: 'org',
|
{
|
||||||
scope: { id: 'global', type: 'global' },
|
type: 'org',
|
||||||
});
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
instances.group = this.server.create('group', {
|
instances.group = this.server.create('group', {
|
||||||
scope: instances.scopes.org,
|
scope: instances.orgScope,
|
||||||
});
|
});
|
||||||
urls.groups = `/scopes/${instances.scopes.org.id}/groups`;
|
urls.groups = `/scopes/${instances.orgScope.id}/groups`;
|
||||||
urls.group = `${urls.groups}/${instances.group.id}`;
|
urls.group = `${urls.groups}/${instances.group.id}`;
|
||||||
urls.newGroup = `${urls.groups}/new`;
|
urls.newGroup = `${urls.groups}/new`;
|
||||||
|
orgURL = `/scopes/${instances.orgScope.id}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can create new group', async function (assert) {
|
test('can create new group', async function (assert) {
|
||||||
@@ -52,6 +57,24 @@ module('Acceptance | groups', function (hooks) {
|
|||||||
assert.equal(this.server.db.groups.length, groupsCount + 1);
|
assert.equal(this.server.db.groups.length, groupsCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('can navigate to new groups route with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(orgURL);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions.groups.includes('create')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.groups}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('cannot navigate to new groups route without proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions.groups = [];
|
||||||
|
await visit(orgURL);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions.groups.includes('create')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.groups}"]`));
|
||||||
|
});
|
||||||
test('can cancel new group creation', async function (assert) {
|
test('can cancel new group creation', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const groupsCount = this.server.db.groups.length;
|
const groupsCount = this.server.db.groups.length;
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { visit, find } from '@ember/test-helpers';
|
||||||
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
|
import {
|
||||||
|
authenticateSession,
|
||||||
|
// These are left here intentionally for future reference.
|
||||||
|
//currentSession,
|
||||||
|
//invalidateSession,
|
||||||
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
|
module('Acceptance | groups | list', function (hooks) {
|
||||||
|
setupApplicationTest(hooks);
|
||||||
|
setupMirage(hooks);
|
||||||
|
let orgURL;
|
||||||
|
|
||||||
|
const instances = {
|
||||||
|
scopes: {
|
||||||
|
global: null,
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const urls = {
|
||||||
|
scopes: {
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
groups: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
hooks.beforeEach(function () {
|
||||||
|
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
instances.group = this.server.create('group', {
|
||||||
|
scope: instances.orgScope,
|
||||||
|
});
|
||||||
|
orgURL = `/scopes/${instances.orgScope.id}`;
|
||||||
|
|
||||||
|
urls.groups = `/scopes/${instances.orgScope.id}/groups`;
|
||||||
|
authenticateSession({});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can navigate to groups with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(orgURL);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions.groups.includes('list')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.groups}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('User cannot navigate to index without either list or create actions', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions.groups = [];
|
||||||
|
await visit(orgURL);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions.groups.includes('list')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.groups}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('User can navigate to index with only create action', async function (assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
instances.orgScope.authorized_collection_actions.groups = ['create'];
|
||||||
|
await visit(orgURL);
|
||||||
|
assert.ok(find(`[href="${urls.groups}"]`));
|
||||||
|
});
|
||||||
|
});
|
||||||
+40
-5
@@ -10,7 +10,7 @@ import {
|
|||||||
//invalidateSession,
|
//invalidateSession,
|
||||||
} from 'ember-simple-auth/test-support';
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
module('Acceptance | host-catalogs', function (hooks) {
|
module('Acceptance | host-catalogs | create', function (hooks) {
|
||||||
setupApplicationTest(hooks);
|
setupApplicationTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ module('Acceptance | host-catalogs', function (hooks) {
|
|||||||
org: null,
|
org: null,
|
||||||
project: null,
|
project: null,
|
||||||
},
|
},
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
const urls = {
|
const urls = {
|
||||||
globalScope: null,
|
globalScope: null,
|
||||||
@@ -35,6 +36,14 @@ module('Acceptance | host-catalogs', function (hooks) {
|
|||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
// Generate resources
|
// Generate resources
|
||||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
instances.scopes.org = this.server.create('scope', {
|
instances.scopes.org = this.server.create('scope', {
|
||||||
type: 'org',
|
type: 'org',
|
||||||
scope: { id: 'global', type: 'global' },
|
scope: { id: 'global', type: 'global' },
|
||||||
@@ -46,21 +55,23 @@ module('Acceptance | host-catalogs', function (hooks) {
|
|||||||
instances.hostCatalog = this.server.create('host-catalog', {
|
instances.hostCatalog = this.server.create('host-catalog', {
|
||||||
scope: instances.scopes.project,
|
scope: instances.scopes.project,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate route URLs for resources
|
// Generate route URLs for resources
|
||||||
urls.globalScope = `/scopes/global/scopes`;
|
urls.globalScope = `/scopes/global/scopes`;
|
||||||
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
|
urls.orgScope = `/scopes/${instances.orgScope.id}/scopes`;
|
||||||
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
|
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
|
||||||
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
|
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
|
||||||
|
|
||||||
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
|
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
|
||||||
urls.unknownHostCatalog = `${urls.hostCatalogs}/foo`;
|
|
||||||
urls.newHostCatalog = `${urls.hostCatalogs}/new`;
|
urls.newHostCatalog = `${urls.hostCatalogs}/new`;
|
||||||
// Generate resource couner
|
// Generate resource couner
|
||||||
gethostCatalogCount = () =>
|
gethostCatalogCount = () =>
|
||||||
this.server.schema.hostCatalogs.all().models.length;
|
this.server.schema.hostCatalogs.all().models.length;
|
||||||
|
|
||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can create new host catalogs', async function (assert) {
|
test('Users can create new host catalogs', async function (assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
const count = gethostCatalogCount();
|
const count = gethostCatalogCount();
|
||||||
await visit(urls.newHostCatalog);
|
await visit(urls.newHostCatalog);
|
||||||
@@ -69,7 +80,7 @@ module('Acceptance | host-catalogs', function (hooks) {
|
|||||||
assert.equal(gethostCatalogCount(), count + 1);
|
assert.equal(gethostCatalogCount(), count + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can cancel create new host catalogs', async function (assert) {
|
test('Users can cancel create new host catalogs', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const count = gethostCatalogCount();
|
const count = gethostCatalogCount();
|
||||||
await visit(urls.newHostCatalog);
|
await visit(urls.newHostCatalog);
|
||||||
@@ -79,6 +90,30 @@ module('Acceptance | host-catalogs', function (hooks) {
|
|||||||
assert.equal(gethostCatalogCount(), count);
|
assert.equal(gethostCatalogCount(), count);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to new host catalogs route with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(urls.projectScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.scopes.project.authorized_collection_actions[
|
||||||
|
'host-catalogs'
|
||||||
|
].includes('create')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.hostCatalogs}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to new host catalogs route without proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.scopes.project.authorized_collection_actions['host-catalogs'] =
|
||||||
|
[];
|
||||||
|
await visit(urls.projectScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.scopes.project.authorized_collection_actions[
|
||||||
|
'host-catalogs'
|
||||||
|
].includes('create')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.hostCatalogs}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
test('saving a new host catalog with invalid fields displays error messages', async function (assert) {
|
test('saving a new host catalog with invalid fields displays error messages', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
this.server.post('/host-catalogs', () => {
|
this.server.post('/host-catalogs', () => {
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { visit, find } from '@ember/test-helpers';
|
||||||
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
|
import {
|
||||||
|
authenticateSession,
|
||||||
|
// These are left here intentionally for future reference.
|
||||||
|
//currentSession,
|
||||||
|
//invalidateSession,
|
||||||
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
|
module('Acceptance | host-catalogs | list', function (hooks) {
|
||||||
|
setupApplicationTest(hooks);
|
||||||
|
setupMirage(hooks);
|
||||||
|
|
||||||
|
const instances = {
|
||||||
|
scopes: {
|
||||||
|
global: null,
|
||||||
|
org: null,
|
||||||
|
project: null,
|
||||||
|
},
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const urls = {
|
||||||
|
scopes: {
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
projectScope: null,
|
||||||
|
hostCatalogs: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
hooks.beforeEach(function () {
|
||||||
|
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
instances.scopes.org = this.server.create('scope', {
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
});
|
||||||
|
instances.scopes.project = this.server.create('scope', {
|
||||||
|
type: 'project',
|
||||||
|
scope: { id: instances.scopes.org.id, type: 'org' },
|
||||||
|
});
|
||||||
|
instances.hostCatalog = this.server.create('host-catalog', {
|
||||||
|
scope: instances.scopes.project,
|
||||||
|
});
|
||||||
|
|
||||||
|
urls.hostCatalogs = `/scopes/${instances.orgScope.id}/host-catalogs`;
|
||||||
|
urls.globalScope = `/scopes/global/scopes`;
|
||||||
|
urls.orgScope = `/scopes/${instances.orgScope.id}/scopes`;
|
||||||
|
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
|
||||||
|
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
|
||||||
|
|
||||||
|
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
|
||||||
|
authenticateSession({});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to host catalogs with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(urls.projectScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.scopes.project.authorized_collection_actions[
|
||||||
|
'host-catalogs'
|
||||||
|
].includes('list')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.hostCatalogs}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('User cannot navigate to index without either list or create actions', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.scopes.project.authorized_collection_actions['host-catalogs'] =
|
||||||
|
[];
|
||||||
|
await visit(urls.projectScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.scopes.project.authorized_collection_actions[
|
||||||
|
'host-catalogs'
|
||||||
|
].includes('list')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.hostCatalogs}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('User can navigate to index with only create action', async function (assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
instances.scopes.project.authorized_collection_actions['host-catalogs'] = [
|
||||||
|
'create',
|
||||||
|
];
|
||||||
|
await visit(urls.projectScope);
|
||||||
|
assert.ok(find(`[href="${urls.hostCatalogs}"]`));
|
||||||
|
});
|
||||||
|
});
|
||||||
+35
-10
@@ -11,7 +11,7 @@ import {
|
|||||||
//invalidateSession,
|
//invalidateSession,
|
||||||
} from 'ember-simple-auth/test-support';
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
module('Acceptance | roles', function (hooks) {
|
module('Acceptance | roles | create', function (hooks) {
|
||||||
setupApplicationTest(hooks);
|
setupApplicationTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
|
||||||
@@ -22,38 +22,44 @@ module('Acceptance | roles', function (hooks) {
|
|||||||
project: null,
|
project: null,
|
||||||
},
|
},
|
||||||
role: null,
|
role: null,
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
const urls = {
|
const urls = {
|
||||||
orgScope: null,
|
|
||||||
roles: null,
|
roles: null,
|
||||||
role: null,
|
role: null,
|
||||||
newRole: null,
|
newRole: null,
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
instances.orgScope = this.server.create(
|
||||||
instances.scopes.org = this.server.create('scope', {
|
'scope',
|
||||||
type: 'org',
|
{
|
||||||
scope: { id: 'global', type: 'global' },
|
type: 'org',
|
||||||
});
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
|
||||||
// The project scope is not yet used for role tests (though it will be
|
// The project scope is not yet used for role tests (though it will be
|
||||||
// in the future). This is created simply to test the grant scope loading
|
// in the future). This is created simply to test the grant scope loading
|
||||||
// mechanism.
|
// mechanism.
|
||||||
instances.scopes.project = this.server.create('scope', {
|
instances.scopes.project = this.server.create('scope', {
|
||||||
type: 'project',
|
type: 'project',
|
||||||
scope: { id: instances.scopes.org.id, type: instances.scopes.org.type },
|
scope: { id: instances.orgScope.id, type: instances.orgScope.type },
|
||||||
});
|
});
|
||||||
instances.role = this.server.create(
|
instances.role = this.server.create(
|
||||||
'role',
|
'role',
|
||||||
{
|
{
|
||||||
scope: instances.scopes.org,
|
scope: instances.orgScope,
|
||||||
},
|
},
|
||||||
'withPrincipals'
|
'withPrincipals'
|
||||||
);
|
);
|
||||||
urls.roles = `/scopes/${instances.scopes.org.id}/roles`;
|
urls.roles = `/scopes/${instances.orgScope.id}/roles`;
|
||||||
urls.role = `${urls.roles}/${instances.role.id}`;
|
urls.role = `${urls.roles}/${instances.role.id}`;
|
||||||
urls.newRole = `${urls.roles}/new`;
|
urls.newRole = `${urls.roles}/new`;
|
||||||
|
urls.orgScope = `/scopes/${instances.orgScope.id}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can create new role', async function (assert) {
|
test('can create new role', async function (assert) {
|
||||||
@@ -65,6 +71,25 @@ module('Acceptance | roles', function (hooks) {
|
|||||||
assert.equal(this.server.db.roles.length, rolesCount + 1);
|
assert.equal(this.server.db.roles.length, rolesCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to new roles route with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions.roles.includes('create')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.roles}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to new roles route without proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions.roles = [];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions.roles.includes('create')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.roles}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
test('can cancel new role creation', async function (assert) {
|
test('can cancel new role creation', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
const rolesCount = this.server.db.roles.length;
|
const rolesCount = this.server.db.roles.length;
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import { module, test } from 'qunit';
|
||||||
|
import { visit, find } from '@ember/test-helpers';
|
||||||
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
|
import {
|
||||||
|
authenticateSession,
|
||||||
|
// These are left here intentionally for future reference.
|
||||||
|
//currentSession,
|
||||||
|
//invalidateSession,
|
||||||
|
} from 'ember-simple-auth/test-support';
|
||||||
|
|
||||||
|
module('Acceptance | roles | list', function (hooks) {
|
||||||
|
setupApplicationTest(hooks);
|
||||||
|
setupMirage(hooks);
|
||||||
|
|
||||||
|
const instances = {
|
||||||
|
scopes: {
|
||||||
|
global: null,
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
const urls = {
|
||||||
|
scopes: {
|
||||||
|
org: null,
|
||||||
|
},
|
||||||
|
roles: null,
|
||||||
|
orgScope: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
hooks.beforeEach(function () {
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
|
instances.role = this.server.create('role', {
|
||||||
|
scope: instances.orgScope,
|
||||||
|
});
|
||||||
|
urls.orgScope = `/scopes/${instances.orgScope.id}`;
|
||||||
|
|
||||||
|
urls.roles = `/scopes/${instances.orgScope.id}/roles`;
|
||||||
|
authenticateSession({});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to roles with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(
|
||||||
|
instances.orgScope.authorized_collection_actions.roles.includes('list')
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.roles}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to index without either list or create actions', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.orgScope.authorized_collection_actions.roles = [];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.notOk(
|
||||||
|
instances.orgScope.authorized_collection_actions.roles.includes('list')
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.roles}"]`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to index with only create action', async function (assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
instances.orgScope.authorized_collection_actions.roles = ['create'];
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
assert.ok(find(`[href="${urls.roles}"]`));
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -15,13 +15,13 @@ import {
|
|||||||
module('Acceptance | sessions', function (hooks) {
|
module('Acceptance | sessions', function (hooks) {
|
||||||
setupApplicationTest(hooks);
|
setupApplicationTest(hooks);
|
||||||
setupMirage(hooks);
|
setupMirage(hooks);
|
||||||
|
|
||||||
const instances = {
|
const instances = {
|
||||||
scopes: {
|
scopes: {
|
||||||
global: null,
|
global: null,
|
||||||
org: null,
|
org: null,
|
||||||
},
|
},
|
||||||
sessions: null,
|
sessions: null,
|
||||||
|
orgScope: null,
|
||||||
};
|
};
|
||||||
const urls = {
|
const urls = {
|
||||||
orgScope: null,
|
orgScope: null,
|
||||||
@@ -31,6 +31,14 @@ module('Acceptance | sessions', function (hooks) {
|
|||||||
hooks.beforeEach(function () {
|
hooks.beforeEach(function () {
|
||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||||
|
instances.orgScope = this.server.create(
|
||||||
|
'scope',
|
||||||
|
{
|
||||||
|
type: 'org',
|
||||||
|
scope: { id: 'global', type: 'global' },
|
||||||
|
},
|
||||||
|
'withChildren'
|
||||||
|
);
|
||||||
instances.scopes.org = this.server.create('scope', {
|
instances.scopes.org = this.server.create('scope', {
|
||||||
type: 'org',
|
type: 'org',
|
||||||
scope: { id: 'global', type: 'global' },
|
scope: { id: 'global', type: 'global' },
|
||||||
@@ -66,6 +74,7 @@ module('Acceptance | sessions', function (hooks) {
|
|||||||
},
|
},
|
||||||
'withAssociations'
|
'withAssociations'
|
||||||
);
|
);
|
||||||
|
urls.orgScope = `/scopes/${instances.scopes.project.id}`;
|
||||||
urls.sessions = `/scopes/${instances.scopes.project.id}/sessions`;
|
urls.sessions = `/scopes/${instances.scopes.project.id}/sessions`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -81,6 +90,38 @@ module('Acceptance | sessions', function (hooks) {
|
|||||||
await visit(urls.sessions);
|
await visit(urls.sessions);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Users cannot navigate to sessions without proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.scopes.project.authorized_collection_actions.sessions = [];
|
||||||
|
authenticateSession({});
|
||||||
|
later(async () => {
|
||||||
|
run.cancelTimers();
|
||||||
|
assert.notOk(
|
||||||
|
instances.scopes.project.authorized_collection_actions.sessions.includes(
|
||||||
|
'list'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.notOk(find(`[href="${urls.sessions}"]`));
|
||||||
|
}, 750);
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Users can navigate to sessions with proper authorization', async function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
instances.scopes.project.authorized_collection_actions.sessions = ['list'];
|
||||||
|
authenticateSession({});
|
||||||
|
later(async () => {
|
||||||
|
run.cancelTimers();
|
||||||
|
assert.ok(
|
||||||
|
instances.scopes.project.authorized_collection_actions.sessions.includes(
|
||||||
|
'list'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
assert.ok(find(`[href="${urls.sessions}"]`));
|
||||||
|
}, 750);
|
||||||
|
await visit(urls.orgScope);
|
||||||
|
});
|
||||||
|
|
||||||
test('visiting sessions without users or targets is OK', async function (assert) {
|
test('visiting sessions without users or targets is OK', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
instances.sessions[0].update({
|
instances.sessions[0].update({
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ module('Acceptance | users | create', function (hooks) {
|
|||||||
assert.equal(this.server.db.users.length, usersCount + 1);
|
assert.equal(this.server.db.users.length, usersCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can navigate to new users route with proper authorization', async function (assert) {
|
test('Users can navigate to new users route with proper authorization', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
await visit(orgURL);
|
await visit(orgURL);
|
||||||
assert.ok(orgScope.authorized_collection_actions.users.includes('create'));
|
assert.ok(orgScope.authorized_collection_actions.users.includes('create'));
|
||||||
assert.ok(find(`[href="${orgURL}/users"]`));
|
assert.ok(find(`[href="${orgURL}/users"]`));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cannot navigate to new users route without proper authorization', async function (assert) {
|
test('Users cannot navigate to new users route without proper authorization', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
orgScope.authorized_collection_actions.users = [];
|
orgScope.authorized_collection_actions.users = [];
|
||||||
await visit(orgURL);
|
await visit(orgURL);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ module('Acceptance | users | list', function (hooks) {
|
|||||||
authenticateSession({});
|
authenticateSession({});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can navigate to users with proper authorization', async function (assert) {
|
test('Users can navigate to users with proper authorization', async function (assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
await visit(orgURL);
|
await visit(orgURL);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
|||||||
Reference in new issue
Block a user