Example #1
0
 public function executeAttachments()
 {
     Attachments::clearTmpUploadedFiles($this->getUser());
     $q = Doctrine_Core::getTable('Attachments')->createQuery()->addWhere('bind_id=?', $this->bind_id)->addWhere('bind_type=?', $this->bind_type)->orderBy('id');
     if ($this->bind_id > 0) {
         $q->addWhere("bind_id='" . $this->bind_id . "' or (bind_id='-" . $this->getUser()->getAttribute('id') . "')");
     } else {
         $q->addWhere("bind_id='-" . $this->getUser()->getAttribute('id') . "'");
     }
     $this->attachments = $q->execute();
 }
Example #2
0
 public function doUserLogin($user, $request)
 {
     $this->getUser()->setAttribute('id', $user->getId());
     $this->getUser()->setAttribute('users_group_id', $user->getUsersGroupId());
     $this->getUser()->setAttribute('user', $user);
     $this->getUser()->setAuthenticated(true);
     Attachments::clearTmpUploadedFiles($this->getUser());
     $this->getUser()->setCulture($user->getCulture());
     if (strlen($user->getSkin()) > 0) {
         $this->getResponse()->setCookie('skin', $user->getSkin(), time() + 31536000, '', '');
     }
     $ug = $user->getUsersGroups();
     if ($ug->getAllowManageProjects() > 0) {
         $this->getUser()->addCredential('reports_access_projects');
     }
     if ($ug->getAllowManageTasks() > 0) {
         $this->getUser()->addCredential('reports_access_tasks');
         $this->getUser()->addCredential('reports_access_time');
         $this->getUser()->addCredential('reports_access_time_personal');
         $this->getUser()->addCredential('reports_access_gantt');
     }
     if ($ug->getAllowManageTickets() > 0) {
         $this->getUser()->addCredential('reports_access_tickets');
     }
     if ($ug->getAllowManageDiscussions() > 0) {
         $this->getUser()->addCredential('reports_access_discussions');
     }
     if ($ug->getAllowManageUsers() == 1) {
         $this->getUser()->addCredential('allow_manage_users');
     }
     if ($ug->getAllowManageConfiguration() == 1) {
         $this->getUser()->addCredential('allow_manage_configuration');
     }
     $this->getUser()->addCredential('allow_manage_personal_scheduler');
     if (strlen($request->getParameter('http_referer')) > 0) {
         $this->redirect($request->getParameter('http_referer'));
     } else {
         $this->redirect('dashboard/index');
     }
 }