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

refactor: Extract ObjectAccess and Administrative permissions into Permission model in admin slice #3152

Merged
merged 18 commits into from Apr 2, 2024

Conversation

seakayone
Copy link
Collaborator

@seakayone seakayone commented Mar 27, 2024

  • Extract ObjectAccess permission to admin slice
  • Replace EntityPermission with ObjectAccess permission
  • Extract Administrative permission to admin slice
  • Introduce common Permission trait
  • Inline PermissionsMessagesUtilADM.scala

Pull Request Checklist

Task Description/Number

Issue Number: DEV-

PR Type

  • build/chore: maintenance tasks (no production code change)
  • docs: documentation changes (no production code change)
  • feat: represents new features
  • fix: represents bug fixes
  • perf: performance improvements
  • refactor: represents production code refactoring
  • test: adding or refactoring tests (no production code change)

Basic requirements for bug fixes and features

  • Tests for the changes have been added
  • Docs have been added / updated

Does this PR introduce a breaking change?

  • Yes

Does this PR change client-test-data?

  • Yes

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 95.49550% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 88.74%. Comparing base (62260e4) to head (6454b6d).
Report is 6 commits behind head on main.

Files Patch % Lines
...knora/webapi/messages/util/PermissionUtilADM.scala 91.30% 2 Missing ⚠️
...rg/knora/webapi/responders/v2/ResourceUtilV2.scala 66.66% 2 Missing ⚠️
...api/responders/admin/PermissionsResponderADM.scala 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3152      +/-   ##
==========================================
- Coverage   88.79%   88.74%   -0.05%     
==========================================
  Files         265      266       +1     
  Lines       22260    22274      +14     
==========================================
+ Hits        19765    19767       +2     
- Misses       2495     2507      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seakayone seakayone changed the title refactor: Extract common ObjectAccessPermissions model into admin slice refactor: Extract ObjectAccessPermission and AdministrativePermission model into admin slice Mar 28, 2024
@seakayone seakayone changed the title refactor: Extract ObjectAccessPermission and AdministrativePermission model into admin slice refactor: Extract ObjectAccessPermission and AdministrativePermission model to admin slice Mar 28, 2024
@seakayone seakayone changed the title refactor: Extract ObjectAccessPermission and AdministrativePermission model to admin slice refactor: Extract ObjectAccess and Administrative permissions into Permission model in admin slice Mar 28, 2024
@seakayone seakayone marked this pull request as ready for review March 28, 2024 12:14
Copy link
Collaborator

@BalduinLandolt BalduinLandolt left a comment

Choose a reason for hiding this comment

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

looks good, thanks!

package org.knora.webapi.slice.admin.domain.model

sealed trait Permission {
def token: String
Copy link
Collaborator

Choose a reason for hiding this comment

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

comment (non-blocking): I find the term token somewhat confusing because it makes me think of JWTs. But I can't think of anything better for now. Maybe in the future we can try to think of something more descriptive.

Copy link
Collaborator Author

@seakayone seakayone Apr 2, 2024

Choose a reason for hiding this comment

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

I am happy to hear any suggestions.

The token contains now the value which is actually written as a token in the hasPermission property:

  • ... knora-api:hasPermissions "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|RV knora-admin:UnknownUser"
  • ... knora-base:hasPermissions "ProjectAdminGroupAllPermission|ProjectResourceCreateRestrictedPermission http://www.knora.org/ontology/0001/example#person,http://www.knora.org/ontology/0001/example#event"

For example the full name for all administrative Permissions like ProjectAdminGroupAllPermission or the abbreviation for the object access permissions like CR. Other property names I have considered were: abbreviation, code, symbol, name, wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I spontaneously like code best. But at the end of the day, I'm ok with either of those as well as with token

@seakayone seakayone merged commit e8f6060 into main Apr 2, 2024
13 checks passed
@seakayone seakayone deleted the refactor/permissions branch April 2, 2024 11:32
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.

None yet

3 participants