示例#1
0
 public function startup()
 {
     parent::startup();
     if ($this->getName() != 'Admin:Sign' && !$this->user->isLoggedIn()) {
         $this->redirect('Sign:default');
     }
     //nastavim prava
     foreach ($this->roles->getAll() as $role) {
         $this->acl->addRole($role['system_name']);
     }
     foreach ($this->resources->getAll() as $resource) {
         $this->acl->addResource($resource['system_name']);
     }
     foreach ($this->permissions->getAll() as $permission) {
         $this->acl->allow($permission->role->system_name, $permission->resource->system_name, $permission->privilege->system_name);
     }
     $this->acl->addRole('super_admin');
     $this->acl->allow('super_admin');
     //homepage a sign maji pristup vsichni
     $this->acl->addResource('homepage');
     $this->acl->allow(\App\AdminModule\Components\Authorizator::ALL, 'homepage');
     $this->acl->addResource('sign');
     $this->acl->allow(\App\AdminModule\Components\Authorizator::ALL, 'sign');
     //vychozi role
     $this->acl->addRole('guest');
     //kontrola prav
     if ($this->getName() != 'Admin:Image' && $this->getAction() != 'ordering' && $this->getAction() != 'orderingCategory' && $this->getAction() != 'deleteImage' && $this->getAction() != 'changePassword' && $this->getAction() != 'getCity' && $this->getAction() != 'download') {
         if (!$this->getUser()->isAllowed($this->getNameSimple(), $this->getAction())) {
             $this->flashMessage($this->translator->translate('admin.login.noAccess'), 'error');
             $this->redirect('Homepage:default');
         }
     }
     //projedu vsek moduly a pokusim se najit presentery
     $presenters = array();
     $vsekDir = dirname(__FILE__) . '/../../../';
     $ch = opendir($vsekDir);
     while (($file = readdir($ch)) !== false) {
         if (!in_array($file, array('.', '..'))) {
             if (file_exists($vsekDir . $file . '/src/setting.xml')) {
                 $xml = simplexml_load_file($vsekDir . $file . '/src/setting.xml');
                 if (isset($xml->presenter)) {
                     $this->menuModules[] = array('name' => (string) $xml->presenter->name, 'resource' => (string) $xml->presenter->resource);
                 }
             }
         }
     }
     closedir($ch);
 }
示例#2
0
 protected function createComponentGridResource($name)
 {
     $grid = new \App\Grid\Grid($this, $name);
     $grid->setModel($this->modelResource->getAll());
     $grid->addColumn(new Column('name', $this->translator->translate('admin.form.name')));
     $grid->addColumn(new Column('system_name', $this->translator->translate('admin.form.systemName')));
     $grid->addColumn(new HasManyPermission('name', $this->translator->translate('admin.privilege.privileges'), $this->getParameter('roleId')));
     $grid->addColumn(new Column('id', $this->translator->translate('admin.grid.id')));
     $grid->addMenu(new \App\Grid\Menu\Update('set', $this->translator->translate('admin.form.set')));
     $grid->setOrder('name');
     return $grid;
 }
示例#3
0
 protected function createComponentGrid($name)
 {
     $grid = new \App\Grid\Grid($this, $name);
     $grid->setModel($this->resources->getAll());
     $grid->addColumn(new Column('name', $this->translator->translate('admin.form.name')));
     $grid->addColumn(new Column('system_name', $this->translator->translate('admin.form.systemName')));
     $grid->addColumn(new HasMany('name', $this->translator->translate('admin.privilege.privileges'), 'resource_privilege', 'privilege'));
     $grid->addColumn(new Column('id', $this->translator->translate('admin.grid.id')));
     $grid->addMenu(new \App\Grid\Menu\Update('edit', $this->translator->translate('admin.form.edit')));
     $grid->addMenu(new \App\Grid\Menu\Delete('delete', $this->translator->translate('admin.grid.delete')));
     $grid->setOrder('name');
     return $grid;
 }