-
Notifications
You must be signed in to change notification settings - Fork 81
[WIP] [AAP-54064] Decoupling apps from ansible_base.rbac #849
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
base: devel
Are you sure you want to change the base?
Conversation
c85d394
to
97d5317
Compare
|
cd97257
to
302d51e
Compare
302d51e
to
fcc27e5
Compare
DVCS PR Check Results: PR appears valid (JIRA key(s) found) |
User = get_user_model() | ||
|
||
|
||
is_rbac_installed = 'ansible_base.rbac' in settings.INSTALLED_APPS |
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 really want to stop doing this referencing of settings.
on import. It's an import circularity problem, and here you don't need it anyway. You can make this into a method.
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.
Yea we do this all over. We might want to just have a generic method like is_dab_app_installed('rbac')
_service_id = str(service_obj.pk) | ||
else: | ||
# Create a ServiceID if none exists | ||
service_obj = ServiceID.objects.create() |
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.
Oh, this is a major thing I had on my agenda.
https://issues.redhat.com/browse/AAP-51352
I had assumed we couldn't do it like this. But I'm not saying no.
"shared.user": ResourceTypeProcessor, | ||
} | ||
if 'ansible_base.rbac' in settings.INSTALLED_APPS: | ||
processors["shared.roledefinition"] = RoleDefinitionProcessor |
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.
👍 agreed.
This should cause no ill-effects. For the major services, we simply don't care about the case that the RBAC app is not installed.
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 somewhat disagree with this. There is no problem with making requests to the RBAC related endpoints when RBAC is not installed locally.
Some methods are still invalid to call, but not all of these.
def to_internal_value(self, data): | ||
if 'ansible_base.rbac' not in settings.INSTALLED_APPS: | ||
raise RuntimeError("LenientPermissionSlugListField requires ansible_base.rbac to be installed") | ||
from ansible_base.rbac.models import DABPermission |
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 seems entirely unnecessary. The rest of changes in this file, yes.
|
||
logger = logging.getLogger('ansible_base.resources_api.tasks.sync') | ||
|
||
_is_rbac_installed = 'ansible_base.rbac' in settings.INSTALLED_APPS |
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.
Here too, I want to bring this in-line.
I put my review comments in john-westcott-iv#11 |
Description
What is being changed?
Attempting to decouple apps from the rbac app.
Why is this change needed?
Devs may want to include apps w/o including the rbac app.
How does this change address the issue?
Removes direct import from ansible_base.rbac but keeps functionally by checking if ansible_base.rbac is installed.
Type of Change
Self-Review Checklist
Testing Instructions
Prerequisites
Steps to Test
Expected Results
Additional Context
Required Actions
Screenshots/Logs