-
-
Notifications
You must be signed in to change notification settings - Fork 965
Permission handling additions #199
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
Comments
decided on using the codename filter function as a key in the permissions section of a group or user yml file. I'm finalizing a PR but basically instead of specifying an optional codename filter function for each codename, The original permissions yaml syntax will assume filter function Will submit the PR shortly |
Thank you for this idea. I have some reservations about this though, as I explain below. Just to be clear, this is my personal opinion so far, it's not a strong opinion yet and I welcome other opinions. What I like: This is a very flexible feature and could make handling permissions in the initializer scripts easier.
On a more general level, I wonder how far we should go with those initializer scripts. They were initially thought to be used to ease local development, i.e. to bootstrap an empty Netbox instance quickly; an instance that does not have many users or other entities and that is eventually destroyed anyway. This is merely a brain-dump and as I said initially, I would love other opinions. Also on how and for what people use the initializer scripts. |
I quite like the idea of simplifying it using asterisks. Should be trivial to determine the codename filter based on placement of the asterisk. I must admit, however, that this PR was stretching my python abilities as is... Speaking to your general comments, I'm using these catchall permission definitions to keep my group permissions up-to-date through the changing netbox schema, so i suspect that would be useful for others as well. I agree that the rest of the initializers probably aren't terribly useful after an initial creation. |
...that was much easier than expected. I've updated the PR to utilize |
This feature is included in the just released version 0.22.0. |
Desired Behavior
Adding onto the discussion in #146 , I would like to include the ability to make the
permission_codename
search function customizableContrast to Current Behavior
currently you must explicitly set all permissions you'd like on a group/user in the yml file. Would like to include the option to change this via the config file (and keep the default as
codename=
Changes Required
I can submit a PR with the changes, but essentially, add the option to check for a custom function for each permission entry. I.E in the
groups.yml
would cause the permissions loop to use
Permission.objects.filter(codename_startswith='add_')
Discussion: Benefits and Drawbacks
Preserves the current functionality and introduces the benefit of being able to make a clean groups.yml file that defines some generic groups:
I haven't started the process of building this out, so i'm unsure if this is the exact syntax, maybe it would just be
but i believe this is possible regardless.
The text was updated successfully, but these errors were encountered: