Tuesday, 30 May 2017

Dynamically adding mixin to a model

I have written a mixin and called it "AuthenticatedFields". It's similar to read-only mixin, however it also takes user roles into consideration. It takes property name and role name as input, and strip data if user doesn't have role to see that property.

// common/models/graphicalmodels.json

"mixins": {
    "AuthenticatedFields": {
      "data": "admin"
    }

However, I want to do that dynamically, not in model config file. Because user permissions should be able to change.

Is it possible to add/remove/change mixins dynamically?



via Cory

No comments:

Post a Comment