Skip to content

Support User groups in permissions listing #3430

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

Open
wants to merge 1 commit into
base: user-groups/permissions
Choose a base branch
from

Conversation

ildyria
Copy link
Member

@ildyria ildyria commented Jun 9, 2025

This pull request introduces support for sharing albums with user groups in addition to individual users. The changes span multiple files to extend the existing sharing functionality, update the database model, and enhance validation and testing. Below is a summary of the most important changes:

Sharing Functionality Enhancements:

  • Updated applyUpdate and applyOverwrite methods in app/Actions/Sharing/Propagate.php to handle permissions for user groups alongside individual users. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-099be4abba0aef41c0c3e3f139f6df0d8b52fcf573d6bc2fe8b120f4be446720L52-R52), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-099be4abba0aef41c0c3e3f139f6df0d8b52fcf573d6bc2fe8b120f4be446720R62), [[3]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-099be4abba0aef41c0c3e3f139f6df0d8b52fcf573d6bc2fe8b120f4be446720L125-R126), [[4]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-099be4abba0aef41c0c3e3f139f6df0d8b52fcf573d6bc2fe8b120f4be446720R135))
  • Modified the Share::do method in app/Actions/Sharing/Share.php to accept both user_id and user_group_id parameters, and added logic to load the associated user group. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-ea159f4821c75cf6a4d3b3271e6273686592607be806df7d3cbfb0719f18dbe2R20-R34), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-ea159f4821c75cf6a4d3b3271e6273686592607be806df7d3cbfb0719f18dbe2R43))

Database Model Updates:

  • Added user_group_id support to the AccessPermission model, including new fillable attributes and type casting. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-1dd7e2eab43d6518186bdf310214c9587a2942a7c98054107001c05054e7422aR76), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-1dd7e2eab43d6518186bdf310214c9587a2942a7c98054107001c05054e7422aR90))
  • Automatically load user groups when retrieving a User model for consistent permission checks. ([app/Models/User.phpR123-R130](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-37a2d7d879a7de3f7d73b2975cd22be9f41ec10c334a0dda9ad1e869332e4ecbR123-R130))

API and Validation Enhancements:

  • Introduced HasUserGroupIds interface and trait to manage user group IDs in requests. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-05b81c40be218dbe45d50a24dd501994bbec1247a72c366620554a1b2eafde89R1-R17), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-90b1d5bd6c3b34b6b303932b9761844cea879eb038795dbcb8e532f5b20be7f2R1-R25))
  • Updated AddSharingRequest to validate user_group_ids and ensure at least one user or group is specified. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-088c4204a668f60ad82325c3f0b14d9d963cf16c242f7acbbb9c938f7e55024eR19-R26), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-088c4204a668f60ad82325c3f0b14d9d963cf16c242f7acbbb9c938f7e55024eR37), [[3]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-088c4204a668f60ad82325c3f0b14d9d963cf16c242f7acbbb9c938f7e55024eL53-R59), [[4]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-088c4204a668f60ad82325c3f0b14d9d963cf16c242f7acbbb9c938f7e55024eR75-R81))

Controller and Query Updates:

  • Enhanced SharingController methods to support user groups in sharing logic, including create, list, and listAll. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-600f9aa425dff07d96b096d9f9dc193ebd32ebfd8b6cacd23dd944f2c53a83dfL49-R77), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-600f9aa425dff07d96b096d9f9dc193ebd32ebfd8b6cacd23dd944f2c53a83dfL95-R117), [[3]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-600f9aa425dff07d96b096d9f9dc193ebd32ebfd8b6cacd23dd944f2c53a83dfL111-R138), [[4]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-600f9aa425dff07d96b096d9f9dc193ebd32ebfd8b6cacd23dd944f2c53a83dfL137-R164))

Test Coverage:

  • Updated and extended tests in tests/Feature_v2/Album/SharingTest.php to cover user group sharing scenarios. ([[1]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7R91), [[2]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7L144-R146), [[3]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7L159-R160), [[4]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7L173-R177), [[5]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7R190), [[6]](https://github.com/LycheeOrg/Lychee/pull/3430/files#diff-a352400531c5477c8773e977ade7e2893623e8766740ca40c918b59f1963a0a7R203))

@ildyria ildyria changed the base branch from master to user-groups/permissions June 9, 2025 21:35
@ildyria ildyria added the Review: easy Easy review expected: probably just need a quick to go through. label Jun 10, 2025
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 86.67%. Comparing base (3756aa0) to head (2982aa2).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria ildyria marked this pull request as ready for review June 10, 2025 11:42
@ildyria ildyria requested a review from a team as a code owner June 10, 2025 11:42
@ildyria ildyria force-pushed the user-groups/permissions branch from f5dc9d0 to 3756aa0 Compare June 11, 2025 13:56
@ildyria ildyria force-pushed the user-groups/listing branch from 5d8cb69 to 465b434 Compare June 11, 2025 13:56
@ildyria ildyria force-pushed the user-groups/listing branch from 465b434 to 2982aa2 Compare June 11, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review: easy Easy review expected: probably just need a quick to go through.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant