public function grid() { $idTransacao = $this->data->id ?: $this->data->idTransacao; $transacao = new Transacao($idTransacao); $this->data->array = $transacao->listGrupos()->asQuery()->getResult(); $this->data->direitos = Manager::getPerms()->getPerms(); $this->render("transacao/gridAcesso"); }
public function checkAccess() { $result = true; $access = $this->getAccess(); if ($access && Manager::isLogged()) { $perms = explode(':', $access); $right = Manager::getPerms()->getRight($perms[1]); $result = Manager::checkAccess($perms[0], $right); } return $result; }
public function invokeHandler($m, $handler) { global $context, $module, $action, $item, $session, $page, $auth, $perms, $navbar, $theme, $history, $self, $url; if ($handler == '') { return false; } //$this->data = $data; $this->action = $handler; $app = Manager::getApp(); if ($m == '' || $m == $app) { $module = $app; $path = Manager::getAppPath() . '/controllers/'; } else { $module = $m; $path = Manager::getModulePath($module, 'controllers/'); } //mdump("Handler:invokeHandler: [$module][$handler]"); $context = Manager::getContext(); $action = $context->getAction(); $self = $context->getAction(); $item = mrequest('item'); $session = Manager::getSession(); $navbar = new MNavigationBar(); //$view = Manager::getView($module, 'handler', $action); $page = $this->theme; $url = Manager::getCurrentURL(); $auth = Manager::getAuth(); $perms = Manager::getPerms(); $theme = $this->theme; $file = $path . $handler . '.inc.php'; //mdump('Handler:invokeHandler: file : ' . $file); if ($return = file_exists($file)) { include $file; } return $return; }
public function formAcesso() { $model = new Transacao($this->data->id); $this->data->object = $model->getData(); $this->data->grupos = Grupo::create()->listAll()->asQuery()->getResult(); $this->data->direitos = Manager::getPerms()->getPerms(); $this->render(); }
public function isMemberOf($group) { return Manager::getPerms()->isMemberOf($group); }
private function handleChildren($control, $node, $addMethod = 'addControl') { $context = $this->localContext; foreach ($node->children() as $i => $n) { if ($this->ignoreElement($n)) { continue; } $e = array(); if ($i == 'event') { foreach ($n->attributes() as $property => $value) { $e[$property] = trim(utf8_decode((string) $value)); } $control->addEvent($e['event'], $e['handler'], $e['preventDefault'] === 'true'); } elseif ($i == 'ajax') { foreach ($n->attributes() as $property => $value) { $e[$property] = trim(utf8_decode((string) $value)); } $url = $this->processValue($e['url']); $control->ajax($e['type'], $e['event'], $url, $e['load'], $e['preventDefault'] === 'true'); } elseif ($i == 'data') { foreach ($n->attributes() as $property => $value) { $e[$property] = trim(utf8_decode((string) $value)); } if ($e['load']) { $value = str_replace("\$this", "\$context", $e['load']); $control->setData(eval('return ' . $value . ';')); } if ($e['id']) { $id = $e['id']; $control->data->{$id} = $this->processValue($e['value']); } } elseif ($i == 'property') { foreach ($n->attributes() as $property => $value) { $control->{$property} = $this->processValue($value); } } elseif ($i == 'attribute') { foreach ($n->attributes() as $property => $value) { $control->addAttribute($property, $this->processValue($value)); } } elseif ($i == 'include') { $this->getControlsFromInclude($n, $control, true); } elseif ($i == 'fields') { $fields = $this->getControlsFromDOM($n); $control->addFields($fields); } elseif ($i == 'buttons') { $buttons = $this->getControlsFromDOM($n); $control->addButtons($buttons); } elseif ($i == 'auth') { foreach ($n->attributes() as $property => $value) { $e[$property] = trim(utf8_decode((string) $value)); } $perms = explode(':', $e['access']); $right = Manager::getPerms()->getRight($perms[1]); $ok = Manager::checkAccess($perms[0], $right); if ($ok) { $this->handleChildren($control, $n, $addMethod); } } elseif ($i == 'help') { $fields = $this->getControlsFromDOM($n); $control->addFields($fields); } elseif ($i == 'validators') { $validators = $this->getControlsFromDOM($n); $control->setValidators($validators); } elseif ($i == 'controls') { $controls = $this->getControlsFromDOM($n); $control->setControls($controls); } elseif ($i == 'actions') { $controls = $this->getControlsFromDOM($n); $control->addAction($controls); } elseif ($i == 'action') { foreach ($n->attributes() as $property => $value) { $e[$property] = $this->processValue($value); } $control->addAction($e['action'], $e['label'], $e['transaction'], $e['access']); } elseif ($i == 'tool') { foreach ($n->attributes() as $property => $value) { $e[$property] = $this->processValue(trim(utf8_decode((string) $value))); } $control->addTool($e['title'], $e['action'], $e['icon']); } elseif ($i == 'method') { foreach ($n->attributes() as $property => $value) { $e[$property] = trim(utf8_decode((string) $value)); } $func = create_function($e['args'], trim(utf8_decode((string) $n[0]))); $name = $e['name']; $control->{$name} = $func; } elseif ($i == 'css') { $this->handleNodeCSS($n); } elseif ($i == 'javascript') { $this->handleNodeJavascript($n); } else { $obj = $control->instance($i); if ($obj instanceof MValidator) { $control->setValidator($obj); } else { $obj->context = $control->context; $this->getControlFromDOM($obj, $n); $control->{$addMethod}($obj); } } } }