Ejemplo n.º 1
0
 /**
  * Current action allowed on the given record?
  *
  * @param array $record record
  *
  * @return bool is action allowed on record?
  */
 public function allowed($record)
 {
     return $this->m_node->allowed($this->m_action, $record);
 }
Ejemplo n.º 2
0
 /**
  * Does the actual loading of the dispatch page
  * And adds it to the page for the dispatch() method to render.
  *
  * @param array $postvars The request variables for the node.
  * @param Node $node
  */
 public function loadDispatchPage($postvars, Node $node)
 {
     $node->m_postvars = $postvars;
     $node->m_action = $postvars['atkaction'];
     if (isset($postvars['atkpartial'])) {
         $node->m_partial = $postvars['atkpartial'];
     }
     $page = $node->getPage();
     $page->setTitle(Tools::atktext('app_shorttitle') . ' - ' . $node->getUi()->title($node->m_module, $node->m_type, $node->m_action));
     if ($node->allowed($node->m_action)) {
         $secMgr = SecurityManager::getInstance();
         $secMgr->logAction($node->m_type, $node->m_action);
         $node->callHandler($node->m_action);
         $id = '';
         if (isset($node->m_postvars['atkselector']) && is_array($node->m_postvars['atkselector'])) {
             $atkSelectorDecoded = [];
             foreach ($node->m_postvars['atkselector'] as $rowIndex => $selector) {
                 list($selector, $pk) = explode('=', $selector);
                 $atkSelectorDecoded[] = $pk;
                 $id = implode(',', $atkSelectorDecoded);
             }
         } else {
             list(, $id) = explode('=', Tools::atkArrayNvl($node->m_postvars, 'atkselector', '='));
         }
         $page->register_hiddenvars(array('atknodeuri' => $node->m_module . '.' . $node->m_type, 'atkselector' => str_replace("'", '', $id)));
     } else {
         $page->addContent($this->accessDeniedPage($node->getType()));
     }
 }