-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
f5dc9d0
to
3756aa0
Compare
465b434
to
2982aa2
Compare
3756aa0
to
6dde592
Compare
2982aa2
to
9cbbc7d
Compare
@@ -186,6 +187,7 @@ public function testOverride(): void | |||
// Set up the permission in subSlbum | |||
$response = $this->actingAs($this->userMayUpload1)->postJson('Sharing', [ | |||
'user_ids' => [$this->userLocked->id], | |||
'group_ids' => [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are adding group_ids, should the assertEquals count calls be for 2 rather than 1? For example in line 199?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6dde592
to
2bbce04
Compare
9cbbc7d
to
8cbd16d
Compare
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:
applyUpdate
andapplyOverwrite
methods inapp/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)
)Share::do
method inapp/Actions/Sharing/Share.php
to accept bothuser_id
anduser_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:
user_group_id
support to theAccessPermission
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)
)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:
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)
)AddSharingRequest
to validateuser_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:
SharingController
methods to support user groups in sharing logic, includingcreate
,list
, andlistAll
. ([[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:
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)
)