コード例 #1
0
 public static function deleteRoleData($id)
 {
     $role = RoleRepository::getRole($id);
     //check if users are assigned to this role, if not delete role else error (to avoid cascade delete)
     $affiliatedUsers = UserRepository::getAffiliatedToCount("role_id", $id);
     if ($affiliatedUsers > 0) {
         Session::flash('warning', 'Cannot delete role, Users are assigned to it');
         return Redirect::to("/system/roles")->send();
     }
     //check if permissions are assigned to this role, if not delete role else error (to avoid cascade delete)
     $affiliatedPermissions = PermissionRepository::getAffiliatedToCount("role_id", $id);
     if ($affiliatedPermissions > 0) {
         Session::flash('warning', 'Cannot delete role, Permissions are assigned to it');
         return Redirect::to("/system/roles")->send();
     }
     $role->delete();
     Session::flash('message', 'Role deleted');
     return Redirect::to("/system/roles")->send();
 }
コード例 #2
0
 public static function populateShowData($id)
 {
     $data['title'] = "View User Details";
     $data['activeLink'] = "user";
     $data['subTitle'] = "View System User Details";
     $data['subLinks'] = array(array("title" => "User List", "route" => "/system/users", "icon" => "<i class='fa fa-th-list'></i>", "permission" => "system_user_can_view"), array("title" => "Add User", "route" => "/system/users/create", "icon" => "<i class='fa fa-plus'></i>", "permission" => "system_user_can_add"), array("title" => "Edit User", "route" => "/system/users/" . $id . "/edit", "icon" => "<i class='fa fa-pencil'></i>", "permission" => "system_user_can_edit"), array("title" => "Delete User", "route" => "/system/users/delete/" . $id, "icon" => "<i class = 'fa fa-trash'></i>", "permission" => "system_user_can_delete"));
     $data['user'] = UserRepository::getUser($id);
     return $data;
 }