chore: 🤖 Update IAM creation to use scopeModel and type
This commit is contained in:
6 files changed
+15
-27
No files matched your search
@@ -15,7 +15,8 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
* @return {Promise[GroupModel]}
|
||||
*/
|
||||
async model() {
|
||||
return this.store.findAll('group', this.scopeAdapterOptions());
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.findAll('group', { adapterOptions: { scopeID } });
|
||||
}
|
||||
|
||||
// =actions
|
||||
@@ -57,7 +58,7 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
@action
|
||||
async delete(group) {
|
||||
try {
|
||||
await group.destroyRecord(this.scopeAdapterOptions());
|
||||
await group.destroyRecord();
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.groups');
|
||||
@@ -66,9 +67,4 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
}
|
||||
}
|
||||
|
||||
scopeAdapterOptions() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return { adapterOptions: { scopeID } };
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export default class ScopesScopeGroupsNewRoute extends Route {
|
||||
* @return {GroupModel}
|
||||
*/
|
||||
model() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('group', { scopeID });
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('group', { type: 'group', scopeModel });
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
* @return {Promise{[RoleModel]}}
|
||||
*/
|
||||
async model() {
|
||||
return this.store.findAll('role', this.scopeAdapterOptions());
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.findAll('role', { adapterOptions: { scopeID } });
|
||||
}
|
||||
|
||||
// =actions
|
||||
@@ -57,7 +58,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
@action
|
||||
async delete(role) {
|
||||
try {
|
||||
await role.destroyRecord(this.scopeAdapterOptions());
|
||||
await role.destroyRecord();
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.roles');
|
||||
@@ -66,9 +67,4 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
}
|
||||
}
|
||||
|
||||
scopeAdapterOptions() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return { adapterOptions: { scopeID } };
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export default class ScopesScopeRolesNewRoute extends Route {
|
||||
* @return {RoleModel}
|
||||
*/
|
||||
model() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('role', { scopeID });
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('role', { type: 'role', scopeModel });
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,8 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
* @return {Promise{[UserModel]}}
|
||||
*/
|
||||
async model() {
|
||||
return this.store.findAll('user', this.scopeAdapterOptions());
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.findAll('user', { adapterOptions: { scopeID } });
|
||||
}
|
||||
|
||||
// =actions
|
||||
@@ -58,7 +59,7 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
@action
|
||||
async delete(user) {
|
||||
try {
|
||||
await user.destroyRecord(this.scopeAdapterOptions());
|
||||
await user.destroyRecord();
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.users');
|
||||
@@ -67,9 +68,4 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
}
|
||||
}
|
||||
|
||||
scopeAdapterOptions() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return { adapterOptions: { scopeID } };
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ export default class ScopesScopeUsersNewRoute extends Route {
|
||||
* @return {UserModel}
|
||||
*/
|
||||
model() {
|
||||
const { id: scopeID } = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('user', { scopeID });
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
return this.store.createRecord('user', { type: 'user', scopeModel });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user