Merge photo comments feature #114
@ -660,21 +660,41 @@ class AlbumController extends Controller
|
|||||||
$album->generateUrlPath();
|
$album->generateUrlPath();
|
||||||
$album->save();
|
$album->save();
|
||||||
|
|
||||||
// Link all default permissions to anonymous users (if a public album)
|
// Link the default permissions (if a public album)
|
||||||
if (!$album->is_permissions_inherited)
|
$isPrivate = (strtolower($request->get('is_private')) == 'on');
|
||||||
|
if (!$album->is_permissions_inherited && !$isPrivate)
|
||||||
{
|
{
|
||||||
$isPrivate = (strtolower($request->get('is_private')) == 'on');
|
$defaultAlbumUserPermissions = AlbumDefaultUserPermission::all();
|
||||||
|
$defaultAlbumGroupPermissions = AlbumDefaultGroupPermission::all();
|
||||||
|
$defaultAnonPermissions = AlbumDefaultAnonymousPermission::all();
|
||||||
|
|
||||||
if (!$isPrivate)
|
/** @var AlbumDefaultAnonymousPermission $permission */
|
||||||
|
foreach ($defaultAnonPermissions as $permission)
|
||||||
{
|
{
|
||||||
/** @var Permission $permission */
|
$album->anonymousPermissions()->attach($permission->permission_id, [
|
||||||
foreach (Permission::where(['section' => 'album', 'is_default' => true])->get() as $permission)
|
'created_at' => new \DateTime(),
|
||||||
{
|
'updated_at' => new \DateTime()
|
||||||
$album->anonymousPermissions()->attach($permission->id, [
|
]);
|
||||||
'created_at' => new \DateTime(),
|
}
|
||||||
'updated_at' => new \DateTime()
|
|
||||||
]);
|
/** @var AlbumDefaultGroupPermission $permission */
|
||||||
}
|
foreach ($defaultAlbumGroupPermissions as $permission)
|
||||||
|
{
|
||||||
|
$album->groupPermissions()->attach($permission->permission_id, [
|
||||||
|
'group_id' => $permission->group_id,
|
||||||
|
'created_at' => new \DateTime(),
|
||||||
|
'updated_at' => new \DateTime()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AlbumDefaultUserPermission $permission */
|
||||||
|
foreach ($defaultAlbumUserPermissions as $permission)
|
||||||
|
{
|
||||||
|
$album->userPermissions()->attach($permission->permission_id, [
|
||||||
|
'user_id' => $permission->user_id,
|
||||||
|
'created_at' => new \DateTime(),
|
||||||
|
'updated_at' => new \DateTime()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user