Example #1
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->registerTask('files', 'list');
     $this->registerTask('update', 'save');
     $this->registerTask('insert', 'save');
     $this->_task = Request::getWord('task', 'list');
     // Load component language file
     Lang::load('com_projects') || Lang::load('com_projects', PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'site');
     // Incoming
     $id = Request::getVar('id', '');
     $this->model = new Project($id);
     // Project did not load?
     if (!$this->model->exists()) {
         throw new Exception(Lang::txt('COM_PROJECTS_PROJECT_CANNOT_LOAD'), 404);
     }
     $contentTasks = array('insert', 'update', 'delete', 'move', 'rename', 'makedirectory');
     // Check authorization
     if (in_array($this->_task, $contentTasks) && !$this->model->access('content') || !$this->model->access('member')) {
         throw new Exception(Lang::txt('ALERTNOTAUTH'), 401);
     }
     // Check for local repo
     if (!$this->model->repo()->exists()) {
         throw new Exception(Lang::txt('COM_PROJECTS_FILES_ERROR_NO_LOCAL_REPO'), 404);
     }
     parent::execute();
 }
Example #2
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->config = Component::params('com_support');
     $this->database = \App::get('db');
     $this->acl = \Components\Support\Helpers\ACL::getACL();
     $this->acl->setUser(User::get('id'));
     parent::execute();
 }
Example #3
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->registerTask('team', 'list');
     $this->_task = Request::getWord('task', 'list');
     // Load component language file
     Lang::load('com_projects') || Lang::load('com_projects', PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'site');
     // Incoming
     $id = Request::getVar('id', '');
     $this->model = new Project($id);
     // Project did not load?
     if (!$this->model->exists()) {
         throw new Exception(Lang::txt('COM_PROJECTS_PROJECT_CANNOT_LOAD'), 404);
     }
     // Check authorization
     if (!$this->model->access('member') && !$this->model->isPublic()) {
         throw new Exception(Lang::txt('ALERTNOTAUTH'), 401);
     }
     parent::execute();
 }
Example #4
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->registerTask('autocomplete', 'list');
     parent::execute();
 }
Example #5
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->registerTask('posts', 'list');
     parent::execute();
 }
Example #6
0
 /**
  * Execute a request
  *
  * @return  void
  */
 public function execute()
 {
     $this->registerTask('files', 'list');
     $this->registerTask('update', 'save');
     $this->registerTask('insert', 'save');
     $this->_task = Request::getWord('task', 'list');
     // Load component language file
     Lang::load('com_projects') || Lang::load('com_projects', PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'site');
     // Incoming
     $id = Request::getVar('id', '');
     $this->model = new Project($id);
     // Project did not load?
     if (!$this->model->exists()) {
         throw new Exception(Lang::txt('COM_PROJECTS_PROJECT_CANNOT_LOAD'), 404);
     }
     $contentTasks = array('insert', 'update', 'delete', 'move', 'rename', 'makedirectory');
     //tasks specific to adapters
     $connectionTasks = array('upload', 'download', 'getmetadata', 'setmetadata');
     // Check authorization
     if (in_array($this->_task, $contentTasks) && !$this->model->access('content') || in_array($this->_task, $connectionTasks) && !$this->model->access('content') || !$this->model->access('member')) {
         throw new Exception(Lang::txt('ALERTNOTAUTH'), 401);
     }
     //connection ID
     $this->cid = Request::getVar('cid', '');
     if (in_array($this->_task, $connectionTasks) && !$this->cid) {
         throw new Exception("This action is only supported by connection adapters", 401);
     }
     //if task involves connections, get the ORM Project object
     //if there is a connection id, get an ORM Connection object as well
     if ($this->cid || $this->_task == 'connections') {
         $this->ormproj = \Components\Projects\Models\Orm\Project::oneOrFail($id);
         if ($this->cid) {
             $this->ormconn = \Components\Projects\Models\Orm\Connection::oneOrFail($this->cid);
         }
     }
     // Check for local repo if no connection has been specified
     if (!$this->cid && !$this->model->repo()->exists()) {
         throw new Exception(Lang::txt('COM_PROJECTS_FILES_ERROR_NO_LOCAL_REPO'), 404);
     }
     parent::execute();
 }
Example #7
0
 /**
  * Execute a request
  *
  * @return    void
  */
 public function execute()
 {
     $this->config = Component::params('com_forum');
     $this->database = \App::get('db');
     parent::execute();
 }