Ejemplo n.º 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;
 }