public function run()
 {
     Permission::where('name', 'LIKE', 'support.category.%')->delete();
     Permission::create(['name' => 'support.category.show', 'display_name' => 'Show support category', 'description' => 'Permission to show a list of or a single category.']);
     Permission::create(['name' => 'support.category.create', 'display_name' => 'Create support category', 'description' => 'Permission to create a new category.']);
     Permission::create(['name' => 'support.category.edit', 'display_name' => 'Edit support category', 'description' => 'Permission to modify an existing category.']);
     Permission::create(['name' => 'support.category.destroy', 'display_name' => 'Delete support category', 'description' => 'Permission to delete an existing category.']);
 }
Esempio n. 2
0
 public function edit($id)
 {
     /* @var User $user */
     $role = Role::find($id);
     $permissions = Permission::lists('display_name', 'id')->all();
     $colors = config('roles.colors');
     return view('user::admin.roles.edit')->with(['role' => $role, 'permissions' => $permissions, 'colors' => $colors]);
 }
 /**
  * Returns an empty error in case of non-existend database (i.e. when working with a newly deployed system).
  *
  * @return array|\Illuminate\Database\Eloquent\Collection|static[]
  */
 protected function getPermission()
 {
     try {
         return Permission::with('roles')->get();
     } catch (PDOException $e) {
         Log::warning('Permission table could not be found when trying to load permissions in AuthServiceProvider');
         return [];
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     Permission::where('name', 'LIKE', 'menu.item.%')->delete();
     Permission::create(['name' => 'menu.item.show', 'display_name' => 'Show menu', 'description' => 'Permission to access the menu component.']);
     Permission::create(['name' => 'menu.item.create', 'display_name' => 'Create menu item', 'description' => 'Permission to create a new menu item.']);
     Permission::create(['name' => 'menu.item.edit', 'display_name' => 'Edit menu item', 'description' => 'Permission to modify an existing menu item.']);
     Permission::create(['name' => 'menu.item.destroy', 'display_name' => 'Delete menu item', 'description' => 'Permission to delete an existing menu item.']);
 }
Esempio n. 5
0
 public function edit($id)
 {
     if (Auth::user()->can('update-roles')) {
         $role = Role::findOrFail($id);
         $role_permission = Role::find($id)->permissions()->lists('permission_id')->toArray();
         $permissions = Permission::lists('display_name', 'id');
         return view('auth::role.edit', compact('role', 'permissions', 'role_permission'));
     }
     return redirect('auth/logout');
 }
Esempio n. 6
0
 public function destroy($id)
 {
     if (Auth::user()->can('delete-permissions')) {
         $permission = Permission::findOrFail($id);
         Permission::destroy($id);
         Session::flash('message', trans('auth::ui.permission.message_delete', array('name' => $permission->name)));
         return redirect('auth/permission');
     }
     return redirect('auth/logout');
 }
 public function run()
 {
     Permission::where('name', 'site.page.show')->delete();
     Permission::create(['name' => 'site.page.show', 'display_name' => 'Show page', 'description' => 'Permission to show a list of or a single page.']);
     Permission::where('name', 'site.page.create')->delete();
     Permission::create(['name' => 'site.page.create', 'display_name' => 'Create page', 'description' => 'Permission to create a new page.']);
     Permission::where('name', 'site.page.edit')->delete();
     Permission::create(['name' => 'site.page.edit', 'display_name' => 'Edit page', 'description' => 'Permission to modify an existing page.']);
     Permission::where('name', 'site.page.destroy')->delete();
     Permission::create(['name' => 'site.page.destroy', 'display_name' => 'Delete page', 'description' => 'Permission to delete an existing page.']);
 }
 public function run()
 {
     Permission::where('name', 'user.user.show')->delete();
     Permission::create(['name' => 'user.user.show', 'display_name' => 'Show user', 'description' => 'Permission to show a list of or a single user.']);
     Permission::where('name', 'user.user.create')->delete();
     Permission::create(['name' => 'user.user.create', 'display_name' => 'Create user', 'description' => 'Permission to create a new user.']);
     Permission::where('name', 'user.user.edit')->delete();
     Permission::create(['name' => 'user.user.edit', 'display_name' => 'Edit user', 'description' => 'Permission to modify an existing user.']);
     Permission::where('name', 'user.user.destroy')->delete();
     Permission::create(['name' => 'user.user.destroy', 'display_name' => 'Delete user', 'description' => 'Permission to delete an existing user.']);
 }
Esempio n. 9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('users')->delete();
     $admin = User::create(['id' => 1, 'name' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'locale' => 'en', 'birthday_at' => '2000-01-01']);
     $fgreinus = User::create(['id' => 2, 'name' => 'fgreinus', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'locale' => 'de', 'birthday_at' => '2000-01-01']);
     $voydz = User::create(['id' => 3, 'name' => 'voydz', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'locale' => 'de', 'birthday_at' => '2000-01-01']);
     $ottowayne = User::create(['id' => 4, 'name' => 'ottowayne', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'locale' => 'de', 'birthday_at' => '2000-01-01']);
     // add user to admin roles
     /** @var Role[] $adminRoles */
     $adminRoles = Role::where('name', 'administrator')->get();
     $admin->saveRoles($adminRoles);
     $fgreinus->saveRoles($adminRoles);
     $voydz->saveRoles($adminRoles);
     $ottowayne->saveRoles($adminRoles);
     // add all permissions to admin roles
     /** @var Permission[] $permissions */
     $permissions = Permission::all();
     foreach ($adminRoles as $role) {
         $role->savePermissions($permissions);
     }
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
 public function index()
 {
     $permissions = Permission::paginate();
     return view('user::admin.permissions.index')->with('permissions', $permissions);
 }