81f209d71e
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required. Also includes refinements/improvements for easier testing of deeply nested components. 1. ember-data adapter/serializer/model triplet for Roles 2. repository, form/validations and searching filter for Roles 3. Moves potentially, repeated, or soon to to repeated functionality into a mixin (mainly for 'many policy' relationships) 4. A few styling tweaks for little edge cases around roles 5. Router additions, Route, Controller and templates for Roles Also see: * UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
33 lines
928 B
JavaScript
33 lines
928 B
JavaScript
import Service from '@ember/service';
|
|
import { get } from '@ember/object';
|
|
|
|
export default Service.extend({
|
|
shouldProxy: function(content, method) {
|
|
return false;
|
|
},
|
|
init: function() {
|
|
this._super(...arguments);
|
|
const content = get(this, 'content');
|
|
for (let prop in content) {
|
|
if (typeof content[prop] === 'function') {
|
|
if (this.shouldProxy(content, prop)) {
|
|
this[prop] = function() {
|
|
const cb = this.execute(content, prop);
|
|
if (typeof cb.then !== 'undefined') {
|
|
return cb.then(method => {
|
|
return method.apply(this, arguments);
|
|
});
|
|
} else {
|
|
return cb.apply(this, arguments);
|
|
}
|
|
};
|
|
} else if (typeof this[prop] !== 'function') {
|
|
this[prop] = function() {
|
|
return content[prop](...arguments);
|
|
};
|
|
}
|
|
}
|
|
}
|
|
},
|
|
});
|