Skip to content
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

Make permission framework aware of deactivated users #11371

Open
jacobtylerwalls opened this issue Aug 20, 2024 · 0 comments
Open

Make permission framework aware of deactivated users #11371

jacobtylerwalls opened this issue Aug 20, 2024 · 0 comments

Comments

@jacobtylerwalls
Copy link
Member

The User model has an is_active flag to allow admins to soft-delete a user by revoking their access without actually removing them and their associated data from the system.

The default ModelBackend authentication backend already takes this into account.

However, the 7.6 permissions framework doesn't seem to take this into account anywhere.

Test case for PermissionsTest:

    def test_inactive_user(self):
        self.user.is_active = False
        self.user.save()

        implicit_permission = user_can_read_resource(
            self.user, self.resource_instance_id
        )
        self.assertIs(implicit_permission, False)
======================================================================
FAIL: test_inactive_user (tests.permissions.permission_tests.PermissionTests.test_inactive_user)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jwalls/prj/arches/tests/permissions/permission_tests.py", line 128, in test_inactive_user
    self.assertIs(implicit_permission, False)
AssertionError: True is not False

----------------------------------------------------------------------
Ran 2 tests in 5.367s

FAILED (failures=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant