-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add role template configuration overwriting #10
Comments
I don't get it... What is this supposed to do in the end? Why do we need it? (maybe you can give me an example where it can be used... I saw a "recursive merge" function in many other modules). Thanks! |
Imagine you have the "Articles" template (like we do in CCTool). Imagine now that the application defines two roles (like we also do in CCTool). One role can only view the template data. The other can also write data for it. We currently solve the access rights by defining an additional template ( Imagine if we had now only 1 template {
"roles": {
"caller_role_object_id": {
"access": "r"
},
"admin_role_object_id": {
"access": "crud"
}
}
} with the difference that the two roles are currently separated in the two different templates. The But now assume the roles in a template look like: {
"roles": {
"caller_role_object_id": {
"access": "crud",
"config": {
"html": "path_that_will_overwrite_default.html"
"!order": "remove the order, the value of this key does not matter",
"label": {
"de": "New German label only"
},
"schema": {
"price": {
"overwrite": true,
"type": "string",
"label": {
"ro": "Preț"
}
}
}
}
}
}
} The examples in the snippet above give you the different ways to overwrite:
|
I have started this in CC-Tooland you have a sample here. There are still problems with schema overwriting because the cached template schema is flat and the role schema is hierarchic. Also the |
Each role should be able to define/overwrite its own template configuration. Add this to a
config
key in the role object. Theconfig
value is an object and this object is recursively merged into the template configuration as follows:!
, regardless of its value, this key must be removed from the template!
)overwrite: true
, this value overrides the value in the initial template.overwrite
options (or set tofalse
) the merging recurses into this object. And the same story from the beginning ...The text was updated successfully, but these errors were encountered: