#84: Corrected permissions query for a non-admin user returning incorrect child albums
This commit is contained in:
parent
33680faf92
commit
566db25316
@ -70,17 +70,20 @@ class DbHelper
|
||||
->leftJoin('permissions AS group_permissions', 'group_permissions.id', '=', 'album_group_permissions.permission_id')
|
||||
->leftJoin('permissions AS user_permissions', 'user_permissions.id', '=', 'album_user_permissions.permission_id')
|
||||
->leftJoin('user_groups', 'user_groups.group_id', '=', 'album_group_permissions.group_id')
|
||||
->where('albums.user_id', $user->id)
|
||||
->orWhere([
|
||||
['group_permissions.section', 'album'],
|
||||
['group_permissions.description', $permission],
|
||||
['user_groups.user_id', $user->id]
|
||||
])
|
||||
->orWhere([
|
||||
['user_permissions.section', 'album'],
|
||||
['user_permissions.description', $permission],
|
||||
['album_user_permissions.user_id', $user->id]
|
||||
]);
|
||||
->where(function($query) use ($user, $permission)
|
||||
{
|
||||
$query->where('albums.user_id', $user->id)
|
||||
->orWhere([
|
||||
['group_permissions.section', 'album'],
|
||||
['group_permissions.description', $permission],
|
||||
['user_groups.user_id', $user->id]
|
||||
])
|
||||
->orWhere([
|
||||
['user_permissions.section', 'album'],
|
||||
['user_permissions.description', $permission],
|
||||
['album_user_permissions.user_id', $user->id]
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
$parentAlbumID = intval($parentAlbumID);
|
||||
|
Loading…
Reference in New Issue
Block a user