예제 #1
0
 /**
  * save User ACL settings
  */
 public function updateACL($section = '')
 {
     $id = $this->obj->getUid();
     if (!$id) {
         return false;
     }
     $objLst = new AclModel();
     $objLst->connectDb();
     if (is_string($section)) {
         $objLst->where("section='{$section}'");
     }
     if (!$objLst->loadList()) {
         return false;
     }
     $i = 0;
     $fc = FrontController::getInstance();
     $db = DbConnector::getConnection();
     $table = $objLst->dbTable('acl_user');
     while ($objLst->next()) {
         if ($fc->getReqVar('acl_' . $objLst->get('name'))) {
             $db->query('INSERT IGNORE INTO `' . $table . '` SET `user_id`=' . $id . ', `acl_id`=' . $objLst->getUid());
         } else {
             $db->query('DELETE IGNORE FROM `' . $table . '` WHERE `user_id`=' . $id . ' AND `acl_id`=' . $objLst->getUid());
         }
         $i++;
     }
     return $i;
 }
예제 #2
0
 public function deleteAction()
 {
     $this->_loadUser();
     if ($this->canDeleteThisUser) {
         if ($this->data->delete()) {
             $db = DbConnector::getConnection();
             // delete this user's rights
             $db->query('DELETE FROM ' . $this->data->dbTable('acl_user') . ' WHERE user_id=' . $this->data->getUid());
             // delete this user's tasks
             $db->query('DELETE FROM ' . $this->data->dbTable('task') . ' WHERE member_id=' . $this->data->getUid());
             $this->fc->redirect($this->fc->getUrl('admin'), 'deleted');
         }
     }
     $this->fc->redirect($this->fc->getUrl('admin'), 'deleted');
 }