-
Notifications
You must be signed in to change notification settings - Fork 132
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
Assign Owner permission to creator for organization account UserProfile #1757
Conversation
c2b11f6
to
60affe6
Compare
This PR contains one approach on how to solve the Issue. The approach: Assign Permissions for |
98f4b69
to
47f0caf
Compare
bed93a4
to
aa04155
Compare
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.
Other than the single comment, it looks good to me!
onadata/apps/api/tests/viewsets/test_organization_profile_viewset.py
Outdated
Show resolved
Hide resolved
aa04155
to
ebf9753
Compare
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!
- Add OwnerRole permissions to creator for OrganizationalProfile.userprofile_ptr
- Assign permission for OrganizationProfile.userprofile_ptr to the Owner of an Org
- Rename test_creator_and_user_permission to test_creator_permissions - Update test to verify object permissions are revoked
ebf9753
to
20c29db
Compare
Changes / Features implemented
OwnerRole
permissions to creator forOrganizationalProfile.userprofile_ptr
Role
permissions from a user when they are removed from an organizationPending work on PR
Steps taken to verify this change does what is intended
Side effects of implementing this change
set_api_permissions
management command needs to be runAdditional Information
Issue #1754 is being caused because the
User
object returned throughUser.objects.get
andget_object_or_404
links to aUserProfile
and not aOrganizationProfile
whenuser.profile
is called. The user / creator in this case normally doesn't have the OwnerRole /can_add_xform
attached to theUserProfile
/org.userprofile_ptr
.The
UserProfile
is present due to how django handles model inheritances(more info on that here), as such it seems for some reason theUser
object defaults to linking toorg_profile.userprofile_ptr
Closes #1754