예제 #1
0
 /**
  * Show the form for editing the role users.
  *
  * @param  int  $id
  * @return Response
  */
 public function editRoleUsers($id)
 {
     if (Shinobi::can(config('watchtower.acl.role.users', false))) {
         $role = Role::findOrFail($id);
         $users = $role->users;
         $available_users = User::whereDoesntHave('roles', function ($query) use($id) {
             $query->where('role_id', $id);
         })->get();
         return view(config('watchtower.views.roles.user'), compact('role', 'users', 'available_users'));
     }
     return view(config('watchtower.views.layouts.unauthorized'), ['message' => 'sync role users']);
 }
예제 #2
0
 /**
  * [userMatrix description]
  * @return Response
  */
 public function showUserMatrix()
 {
     if (Shinobi::can(config('watchtower.acl.user.viewmatrix', false))) {
         $roles = Role::all();
         $users = User::all();
         $us = DB::table('role_user')->select('role_id as r_id', 'user_id as u_id')->get();
         $pivot = [];
         foreach ($us as $u) {
             $pivot[] = $u->r_id . ":" . $u->u_id;
         }
         return view(config('watchtower.views.users.usermatrix'), compact('roles', 'users', 'pivot'));
     }
     return view(config('watchtower.views.layouts.unauthorized'), ['message' => 'sync user roles']);
 }