예제 #1
0
 public static function addRole(AclRole $role)
 {
     $new_role = Role::create(['name' => $role->name, 'type' => $role->type, 'default' => $role->default]);
     $role->role_id = $new_role->role_id;
     RolePermission::updateRolePermissions($role);
     UserRole::updateRoleUsers($role);
     return $role->role_id;
 }
예제 #2
0
 public static function getDefaultRoleId()
 {
     $default_role = Config::get('acl::default_role', false);
     if ($default_role) {
         $role = Role::where('name', '=', $default_role)->where('default', '=', 1)->get();
         return $role->count() ? $role[0]->role_id : false;
     }
     return false;
 }
 public function getRoles(array $roleIds = [], $resources = [])
 {
     $roles = Role::getRoles($roleIds, [$this->role_type], false);
     $group_resources = GroupResources::getGroupResources();
     $permissions = new Collection();
     foreach ($group_resources as $resource) {
         $permissions[] = $this->getPermission($resource);
     }
     foreach ($roles as &$role) {
         $role->permissions = $permissions;
     }
     return $roles;
 }
예제 #4
0
 public function removeRole($roleId)
 {
     return Role::removeRole($roleId);
 }