2017-02-17 08:57:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class PermissionsSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function run()
|
2017-04-15 09:41:15 +01:00
|
|
|
{
|
|
|
|
$this->seedAlbumPermissions();
|
|
|
|
$this->seedAdminPermissions();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function seedAdminPermissions()
|
|
|
|
{
|
|
|
|
// admin:access = controls if the admin panel is accessible
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'access',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
|
|
|
|
|
|
|
// admin:configure = controls if the system is configurable
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'configure',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
|
|
|
|
|
|
|
// admin:manage-albums = controls if albums can be managed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'manage-albums',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
2017-04-15 09:58:33 +01:00
|
|
|
|
|
|
|
// admin:manage-groups = controls if groups can be managed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'manage-groups',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
|
|
|
|
|
|
|
// admin:manage-storage = controls if storages can be managed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'manage-storage',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
|
|
|
|
|
|
|
// admin:manage-users = controls if users can be managed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'manage-users',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
2017-09-10 09:07:56 +01:00
|
|
|
|
|
|
|
// admin:manage-labels = controls if photo labels can be managed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'admin',
|
|
|
|
'description' => 'manage-labels',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 0
|
|
|
|
]);
|
2017-04-15 09:41:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function seedAlbumPermissions()
|
2017-02-17 08:57:05 +00:00
|
|
|
{
|
2017-03-21 22:10:36 +00:00
|
|
|
// album:list = controls if the album is visible in listings
|
2017-02-17 08:57:05 +00:00
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
2017-03-21 22:10:36 +00:00
|
|
|
'description' => 'list',
|
2017-03-21 21:48:55 +00:00
|
|
|
'is_default' => true,
|
|
|
|
'sort_order' => 0
|
2017-02-17 08:57:05 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
// album:view = controls if the album can be viewed
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'view',
|
2017-03-21 21:48:55 +00:00
|
|
|
'is_default' => true,
|
|
|
|
'sort_order' => 20
|
|
|
|
]);
|
|
|
|
|
2017-03-21 22:18:29 +00:00
|
|
|
// album:edit = controls if the album can be edited in the admin panel
|
2017-03-21 21:48:55 +00:00
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'edit',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 21:48:55 +00:00
|
|
|
'sort_order' => 10
|
2017-02-17 08:57:05 +00:00
|
|
|
]);
|
2017-03-21 22:18:29 +00:00
|
|
|
|
|
|
|
// album:delete = controls if the album can be deleted from the admin panel
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'delete',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 22:18:29 +00:00
|
|
|
'sort_order' => 20
|
|
|
|
]);
|
|
|
|
|
|
|
|
// album:upload-photos = controls if photos can be uploaded into the album
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'upload-photos',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 22:18:29 +00:00
|
|
|
'sort_order' => 30
|
|
|
|
]);
|
|
|
|
|
|
|
|
// album:edit-own-photos = controls if existing photos, owned by the current user, in the album can be edited
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
2017-04-16 09:00:57 +01:00
|
|
|
'description' => 'manipulate-photos',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 22:18:29 +00:00
|
|
|
'sort_order' => 40
|
|
|
|
]);
|
|
|
|
|
|
|
|
// album:edit-other-photos = controls if existing photos, owned by other users, in the album can be edited
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
2017-04-16 09:00:57 +01:00
|
|
|
'description' => 'change-photo-metadata',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 22:18:29 +00:00
|
|
|
'sort_order' => 50
|
|
|
|
]);
|
|
|
|
|
|
|
|
// album:delete-own-photos = controls if existing photos, owned by the current user, in the album can be deleted
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
2017-04-16 09:00:57 +01:00
|
|
|
'description' => 'delete-photos',
|
2017-04-18 20:07:03 +01:00
|
|
|
'is_default' => false,
|
2017-03-21 22:18:29 +00:00
|
|
|
'sort_order' => 60
|
|
|
|
]);
|
2018-09-19 19:54:59 +01:00
|
|
|
|
|
|
|
// album:moderate-comments = moderate comments posted on photos
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'moderate-comments',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 70
|
|
|
|
]);
|
2018-09-20 14:38:34 +01:00
|
|
|
|
|
|
|
// album:moderate-comments = moderate comments posted on photos
|
|
|
|
DatabaseSeeder::createOrUpdate('permissions', [
|
|
|
|
'section' => 'album',
|
|
|
|
'description' => 'post-comment',
|
|
|
|
'is_default' => false,
|
|
|
|
'sort_order' => 80
|
|
|
|
]);
|
2017-02-17 08:57:05 +00:00
|
|
|
}
|
|
|
|
}
|