示例#1
0
 /** 
  * Get user group object
  * */
 function getUserType()
 {
     $o = new UserTypeModel();
     if ($this->user_type_id > 0) {
         $o->load($this->user_type_id);
     }
     return $o;
 }
示例#2
0
 function ChangeAccessAction()
 {
     $request = Project::getRequest();
     $group_model = new UserTypeModel();
     $group_data = $group_model->load($request->gid);
     if (!count($group_data)) {
         // Bad request:: group not exists
         return;
     }
     $controller_model = new ControllerModel();
     $controller_data = $controller_model->load($request->cid);
     if (!count($controller_data)) {
         // Bad request:: controller not exists
         return;
     }
     $action_model = new ActionModel();
     $action_data = $action_model->load($request->id);
     if (!count($action_data)) {
         // Bad request:: action not exists
         return;
     }
     $right_model = new UserRightModel();
     $right_data = $right_model->loadByTypeControllerAction($request->gid, $request->cid, $request->id);
     if (!count($right_data)) {
         $right_model->user_type_id = $request->gid;
         $right_model->controller_id = $request->cid;
         $right_model->action_id = $request->id;
         $right_model->access = 1;
     } else {
         $right_model->access = 1 - (int) $right_model->access;
     }
     $right_model->save();
 }