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

Fix user_can_* checks handling of resource kwarg #11753

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

jacobtylerwalls
Copy link
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

Fixes a regression in c86d4d9 -- we need to allow passing either a resource model instance or a resource id string after that change.

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Ticket Background

@aarongundel
Copy link
Contributor

@jacobtylerwalls looks like there are some failing permissions tests here.

@@ -15,11 +17,16 @@ class InstancePermissionsAPITest(TestCase):
def setUpTestData(cls):
cls.graph = Graph.new(
name="INSTANCE_PERMISSIONS_TEST_GRAPH",
is_resource=True,
is_resource=False, # creates a nodegroup, will undo this below.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted this test to create a nodegroup on this test graph because the resource permissions checks return False if there are no nodegroups, and the sense of the test is that (with default allow) the anonymous user should pass.

The fact that this was failing on my first push before I adjusted the test setup is a smell related to the bug I was fixing here.

Copy link
Contributor

@aarongundel aarongundel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacobtylerwalls jacobtylerwalls merged commit 556854b into dev/8.0.x Jan 28, 2025
7 checks passed
@jacobtylerwalls jacobtylerwalls deleted the jtw/fix-resource-instance-perm-check branch January 28, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants