-
Notifications
You must be signed in to change notification settings - Fork 13
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 a permission group that allows members to create names with underscores #521
Conversation
This commit adds a new permission group that allows members of that group to use the underscore character in names when creating all types of DNS records. Regular users are still only allowed to use underscores in SRV records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conforms to current design. Looks acceptable to me. ;)
if '_' in name and not isinstance(view, (mreg.api.v1.views.SrvDetail, | ||
mreg.api.v1.views.SrvList)): | ||
mreg.api.v1.views.SrvList)) \ | ||
and not request_in_settings_group(request, DNS_UNDERSCORE_GROUP): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This... works, and as the code base is now this is probably the correct implementation, but checking permissions by either the class of calling view or if the request (hopefully request.user) is a member of a group? It looks really ugly in my opinion. However, it's the way it's done right now and we should probably do a larger cleanup pass rather than making piecemeal changes that only adds to the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Let's take a look at how the permissions are implented at a later time. I think a re-write may be good, we can do things in a consistent way across the whole code base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds a new permission group that allows members of that group to use the underscore character in names when creating all types of DNS records.
Regular users are still only allowed to use underscores in SRV records.
Bakgrunn:
Utdrag fra epost-tråd mellom Øyvind H. og Mikael D. fredag 27.oktober: