Esempio n. 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $application = Application::create(['name' => 'Soda']);
     $application_url = ApplicationUrl::create(['application_id' => $application->id, 'domain' => 'soda.dev', 'folder' => '']);
     $user = User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => \Hash::make('password')]);
     $role_global_admin = Role::create(['name' => 'global_admin', 'display_name' => 'Global Administrator', 'description' => 'User is the administrator of all applications', 'application_id' => $application->id]);
     $role_admin = Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'User is the administrator of a given application', 'application_id' => $application->id]);
     $role_user = Role::create(['name' => 'user', 'display_name' => 'User', 'description' => 'Standard user (authenticated)', 'application_id' => $application->id]);
     $role_guest = Role::create(['name' => 'guest', 'display_name' => 'Guest', 'description' => 'Unauthenticated user', 'application_id' => $application->id]);
     $basic_admin = Permission::create(['name' => 'basic-admin', 'display_name' => 'Basic Admin', 'description' => 'User can access basic admin features', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_own_permissions = Permission::create(['name' => 'manage-own-permissions', 'display_name' => 'Manage own permissions', 'description' => 'User can manage own permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_permissions = Permission::create(['name' => 'manage-permissions', 'display_name' => 'Manage permissions', 'description' => 'User can manage permissions', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_groups = Permission::create(['name' => 'manage-roles', 'display_name' => 'Manage roles', 'description' => 'User can manage roles', 'section' => 'admin', 'application_id' => $application->id]);
     $manage_users = Permission::create(['name' => 'manage-users', 'display_name' => 'Manage users', 'description' => 'User can manage users', 'section' => 'admin', 'application_id' => $application->id]);
     $user->applications()->attach($application);
     $role_global_admin->attachPermission($basic_admin);
     $role_global_admin->attachPermission($manage_own_permissions);
     $role_global_admin->attachPermission($manage_permissions);
     $role_global_admin->attachPermission($manage_groups);
     $role_global_admin->attachPermission($manage_users);
     $role_admin->attachPermission($basic_admin);
     $role_admin->attachPermission($manage_own_permissions);
     $role_admin->attachPermission($manage_permissions);
     $role_admin->attachPermission($manage_groups);
     $role_admin->attachPermission($manage_users);
     $user->attachRole($role_global_admin);
 }
Esempio n. 2
0
 /**
  * Auto generated seed file
  *
  * @return void
  */
 public function run()
 {
     $role_developer = Role::create(['name' => 'developer', 'display_name' => 'Developer', 'description' => 'Developers gain access to additional functionality']);
     $role_admin = Role::create(['name' => 'admin', 'display_name' => 'Admin', 'description' => 'Admins have high-level access to the CMS. Recommended for clients.']);
     $permission_access_cms = Permission::create(['name' => 'access-cms', 'display_name' => 'Access CMS', 'description' => 'Allow login/access to CMS.']);
     $permission_view_users = Permission::create(['name' => 'view-users', 'display_name' => 'View Users', 'description' => 'View list of users and their details.']);
     $permission_edit_users = Permission::create(['name' => 'edit-users', 'display_name' => 'Edit Users', 'description' => 'Edit user profile information.']);
     $permission_create_users = Permission::create(['name' => 'create-users', 'display_name' => 'Create Users', 'description' => 'Create new user accounts.']);
     $permission_delete_users = Permission::create(['name' => 'delete-users', 'display_name' => 'Delete Users', 'description' => 'Delete existing user accounts.']);
     $permission_view_pages = Permission::create(['name' => 'view-pages', 'display_name' => 'View Pages', 'description' => 'View list of pages and their contents.']);
     $permission_edit_pages = Permission::create(['name' => 'edit-pages', 'display_name' => 'Edit Pages', 'description' => 'Edit page content.']);
     $permission_create_pages = Permission::create(['name' => 'create-pages', 'display_name' => 'Create Pages', 'description' => 'Create new pages.']);
     $permission_delete_pages = Permission::create(['name' => 'delete-pages', 'display_name' => 'Delete Pages', 'description' => 'Delete existing pages.']);
     $permission_manage_page_types = Permission::create(['name' => 'manage-page-types', 'display_name' => 'Manage Page Types', 'description' => 'Manage types to build pages from.']);
     $permission_advanced_pages = Permission::create(['name' => 'advanced-pages', 'display_name' => 'Pages (advanced options)', 'description' => 'Access advanced page options.']);
     $permission_view_blocks = Permission::create(['name' => 'view-blocks', 'display_name' => 'View Blocks', 'description' => 'View list of blocks and their contents.']);
     $permission_edit_blocks = Permission::create(['name' => 'edit-blocks', 'display_name' => 'Edit Blocks', 'description' => 'Edit blocks content.']);
     $permission_create_blocks = Permission::create(['name' => 'create-blocks', 'display_name' => 'Create Blocks', 'description' => 'Create new blocks.']);
     $permission_delete_blocks = Permission::create(['name' => 'delete-blocks', 'display_name' => 'Delete Blocks', 'description' => 'Delete existing blocks.']);
     $permission_manage_block_types = Permission::create(['name' => 'manage-block-types', 'display_name' => 'Manage Block Types', 'description' => 'Manage types to build blocks from.']);
     $permission_advanced_blocks = Permission::create(['name' => 'advanced-blocks', 'display_name' => 'Blocks (advanced options)', 'description' => 'Access advanced block options.']);
     $permission_manage_fields = Permission::create(['name' => 'manage-fields', 'display_name' => 'Manage Fields', 'description' => 'Manage fields association with page/block content.']);
     $permission_view_drafts = Permission::create(['name' => 'view-drafts', 'display_name' => 'View Drafts', 'description' => 'View content in draft mode on the live site.']);
     $role_developer->attachPermissions([$permission_manage_page_types, $permission_advanced_pages, $permission_manage_block_types, $permission_advanced_blocks, $permission_manage_fields, $permission_view_drafts]);
     $role_admin->attachPermissions([$permission_access_cms, $permission_view_users, $permission_edit_users, $permission_create_users, $permission_delete_users, $permission_view_pages, $permission_edit_pages, $permission_create_pages, $permission_delete_pages, $permission_view_blocks, $permission_edit_blocks, $permission_create_blocks, $permission_delete_blocks]);
 }