fix: 🐛 fixes issue where grant strings become corrupted in ui
This commit is contained in:
8 files changed
+41
-49
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import GeneratedRoleModel from '../generated/models/role';
|
||||
import { fragmentArray } from 'ember-data-model-fragments/attributes';
|
||||
import { fragmentArray, array } from 'ember-data-model-fragments/attributes';
|
||||
|
||||
export default class RoleModel extends GeneratedRoleModel {
|
||||
// =attributes
|
||||
@@ -18,23 +18,24 @@ export default class RoleModel extends GeneratedRoleModel {
|
||||
principals;
|
||||
|
||||
/**
|
||||
* Grants is read-only _most_ under normal circumstances. But grants can
|
||||
* be persisted via a dedicated call to `saveGrants()`.
|
||||
* Grants is read-only. But grants can be persisted via a dedicated
|
||||
* call to `saveGrants(grants)`.
|
||||
*/
|
||||
@fragmentArray('fragment-string', { readOnly: true }) grants;
|
||||
@array('string', { readOnly: true }) grant_strings;
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* Saves the `grants` array on the role via the `set-grants` method.
|
||||
* See serializer and adapter for more information.
|
||||
* @param {[string]} grants
|
||||
* @return {Promise}
|
||||
*/
|
||||
saveGrants() {
|
||||
saveGrants(grants) {
|
||||
return this.save({
|
||||
adapterOptions: {
|
||||
method: 'set-grants',
|
||||
serializeGrants: true,
|
||||
grants
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user