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

Access permissions 2: New LanguagePermissions class #6876

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

lukasbestle
Copy link
Member

@lukasbestle lukasbestle commented Dec 19, 2024

Description

Summary of changes

Refactor out the permission handling for Cms\Language into LanguagePermissions to be consistent with other ModelPermissions classes

Reasoning

Consistency when we add additional permissions for languages

Changelog

Refactoring

  • ModelPermissions now also supports Language objects as quasi models
  • New LanguagePermissions class that inherits the existing logic from LanguageRules for consistency with other models

Breaking changes

None

Docs

None

Ready?

  • In-code documentation (wherever needed)
  • Unit tests for fixed bug/feature
  • Tests and CI checks all pass

For review team

  • Add lab and/or sandbox examples (wherever helpful)
  • Add changes & docs to release notes draft in Notion

@lukasbestle lukasbestle added the type: refactoring ♻️ Is about bad code; cleans up code label Dec 19, 2024
@lukasbestle lukasbestle added this to the 5.0.0-beta.2 milestone Dec 19, 2024
Without having a current user, the permission would be `false` even if the logic test in `canChangeRole()` would not work, thus making the test useless; in fact just adding the impersonation made the test fail because manually creating a user object didn’t trigger the `isLastAdmin()` logic
@lukasbestle lukasbestle force-pushed the v5/feature/access-permissions-2 branch from bcf32ce to 2be7d6d Compare December 19, 2024 21:06
Copy link
Member

@bastianallgeier bastianallgeier left a comment

Choose a reason for hiding this comment

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

Nice!

@bastianallgeier bastianallgeier merged commit 3ca5f87 into v5/develop Dec 20, 2024
12 checks passed
@bastianallgeier bastianallgeier deleted the v5/feature/access-permissions-2 branch December 20, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: refactoring ♻️ Is about bad code; cleans up code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants