Exemple #1
0
 public function execute()
 {
     $error = '';
     $res = false;
     $message = '';
     try {
         $request = Miao_Office_Request::getInstance();
         $groupId = $request->getValueOf('group_id');
         $resourceId = $request->getValueOf('resource_id');
         $action = $request->getValueOf('action');
         $acs = Miaox_Acs_Instance::adapter();
         $class = 'icon-off';
         if ($action) {
             $class = 'icon-ok';
             $res = $acs->allowResource($groupId, $resourceId);
             $message .= 'Success allow. ';
         } else {
             $res = $acs->denyResource($groupId, $resourceId);
             $message .= 'Success deny. ';
         }
         if (false === $res) {
             $error = 'Something wrong';
         }
         $message .= sprintf('Group id: %s, resource_id: %s, action: %s', $groupId, $resourceId, $action);
     } catch (Exception $e) {
         $error = $e->getMessage();
     }
     $data = array('message' => $message, 'error' => $error, 'class' => $class);
     return json_encode($data);
 }
Exemple #2
0
 /**
  * Init view bloks and template params for layout
  */
 public function _initializeBlock()
 {
     parent::_initializeBlock();
     $adapter = Miaox_Acs_Instance::adapter();
     $permission = $adapter->permission()->getList();
     $group = $adapter->group()->getList();
     $this->setTmplVars('permission', $permission);
     $this->setTmplVars('group', $group);
     $this->setTmplVars('bodyClass', 'access_group');
 }
Exemple #3
0
        require_once __DIR__ . '/bootstrap.php';
    } else {
        if (file_exists($bootstrap) && is_readable($bootstrap)) {
            require_once $bootstrap;
        } else {
            $msg = sprintf('Invalid param --bootstrap, file (%s) not found or is not readable', $bootstrap);
            throw new Exception($msg);
        }
    }
}
try {
    $bootstrap = '';
    $opts = getopt('', array('bootstrap:'));
    extract($opts);
    includeBootstrap($bootstrap);
    $log = Miao_Log::easyFactory('', true);
    $message = 'Run script: ' . __FILE__;
    $log->debug($message);
    $message = sprintf('Params: %s', print_r($opts, true));
    $log->debug($message);
    $config = Miaox_Acs_Instance::getConfig();
    $config['log']['verbose'] = true;
    $adapter = Miaox_Acs_Instance::adapter($config);
    $builder = new Miaox_Acs_Adapter_Db_Builder($adapter);
    $builder->run();
} catch (Exception $ex) {
    echo "\n";
    echo "Error!\n";
    echo $ex->getMessage();
    echo "\n\n";
}