fix: 🐛 fixes issue where grant strings become corrupted in ui

This commit is contained in:
Randall Morey committed 2020-10-30 13:23:19 -04:00
1 parent cf5e17af28
commit efa851928a
8 files changed
+41 -49

No files matched your search

+7 -6
View File
@@ -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
},
});
}