コード例 #1
0
 public function initialize()
 {
     $resource_id = new Select('resource_id', \Modules\Backend\Models\Permission_resource::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($resource_id);
     $config_id = new Select('config_id', \Modules\Backend\Models\Permission_config::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($config_id);
 }
コード例 #2
0
 public function initialize()
 {
     $name = new Text("name");
     $name->addValidator(new PresenceOf(array('message' => 'name')));
     $this->add($name);
     $this->add(new Select("permission", array("full" => "Full", "limit" => "Limit"), array('class' => 'medium')));
     $this->add(new Select('status', array('0' => 'Không', '1' => 'Có'), array('class' => 'medium')));
     $this->add(new Text("position", array('class' => 'txt_medium')));
     $resource_id = new Select('resource_id', \Modules\Backend\Models\Permission_resource::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($resource_id);
 }
コード例 #3
0
ファイル: Auth.php プロジェクト: quyquoc/rmt-studio.com
 private function setPermissionCKFinder()
 {
     $identity = $this->session->get('auth-identity');
     $resource_id = $identity['resource'];
     $conditions = "id = :id: AND status = 1";
     $resource = \Modules\Backend\Models\Permission_resource::findFirst(array("conditions" => $conditions, "bind" => array("id" => $resource_id)));
     $this->session->set('ckfinder', array('BaseUrl' => UPLOAD_DIR, 'IsAuthorized' => true, 'Permission' => $resource->permission));
     // Tồn tại nhóm quyền resource
     if ($resource) {
         if ($resource->permission == "full") {
             $_SESSION['ckfinder']['AccessControl'][] = array('role' => '*', 'resourceType' => '*', 'folder' => '/', 'folderView' => true, 'folderCreate' => true, 'folderRename' => true, 'folderDelete' => true, 'fileView' => true, 'fileUpload' => true, 'fileRename' => true, 'fileDelete' => true);
         } else {
             $_SESSION['ckfinder']['AccessControl'][] = array('role' => '*', 'resourceType' => '*', 'folder' => '/', 'folderView' => true, 'folderCreate' => true, 'folderRename' => true, 'folderDelete' => true, 'fileView' => false, 'fileUpload' => true, 'fileRename' => true, 'fileDelete' => true);
             $conditions = "resource_id = :resource_id:";
             $resource_config = \Modules\Backend\Models\Permission_resource_config::find(array("conditions" => $conditions, "bind" => array("resource_id" => $resource_id)));
             foreach ($resource_config as $key => $value) {
                 $_SESSION['ckfinder']['AccessControl'][] = array('role' => '*', 'resourceType' => $value->config->type, 'folder' => '/' . $value->config->folder, 'folderView' => $value->config->folder_view == 1 ? true : false, 'folderCreate' => $value->config->folder_create == 1 ? true : false, 'folderRename' => $value->config->folder_rename == 1 ? true : false, 'folderDelete' => $value->config->folder_delete == 1 ? true : false, 'fileView' => $value->config->file_view == 1 ? true : false, 'fileUpload' => $value->config->file_upload == 1 ? true : false, 'fileRename' => $value->config->file_rename == 1 ? true : false, 'fileDelete' => $value->config->file_delete == 1 ? true : false);
             }
         }
     } else {
         // Tắt kích hoạt resource -> Không truy cập vào folder được
         $_SESSION['ckfinder']['AccessControl'][] = array('role' => '*', 'resourceType' => '*', 'folder' => '/', 'folderView' => false, 'folderCreate' => false, 'folderRename' => false, 'folderDelete' => false, 'fileView' => false, 'fileUpload' => false, 'fileRename' => false, 'fileDelete' => false);
     }
 }