Indica si el usuario logueado tiene acceso a un modulo
@param Request $request
@param string $moduleName
@return boolean
485248
public function userHasAccess($request, $moduleName){
        //Tipo por defecto
        $userProfile= $this->getUserProfiles($request);
        $maps= FALSE;
        if(is_array($userProfile)){
            $maps= $this->profilesHasAccess($userProfile, $moduleName);
        }else{
            $maps= $this->profileHasAccess($userProfile, $moduleName);
        }
        return $maps;
    }
925565
protected function removeModuleDirectory($moduleName)
    {
        $this->files->deleteDirectory($this->getModuleDirectory($moduleName));
        if($this->files->exists($this->getModuleDirectory($moduleName)))
        {
            $this->errors->add('delete_files', 'Unable to delete '.$this->getModuleDirectory($moduleName));
            return false;
        }
        return true;
    }
720172
public function getModuleDirectory($moduleName)
    {
        if ($this->files->exists($this->path.'/'.$moduleName))
            return $this->path.'/'.$moduleName;

        else
            return false;
    }
586799
public function searchAction(Request $request)
    {
        $acl = $this->get('bacon_acl.service.authorization');

        if (!$acl->authorize('module-actions', 'INDEX')) {
            throw $this->createAccessDeniedException();
        }

        $this->get('session')->remove('moduleactions_search_session');

        if ($request->getMethod() === Request::METHOD_POST) {
            $entityName     =   $this->getParameter('bacon_acl.entities.module_actions');
            $formTypeName   =   $this->getParameter('bacon_acl.forms.module_actions_form_type_class');

            $form = $this->createForm($formTypeName, new $entityName(), [
                'search' => true,
            ]);

            $form->handleRequest($request);

            $this->get('session')->set('moduleactions_search_session', serialize($form->getData()));
        }

        return $this->redirect($this->generateUrl('module_actions'));
    }
696284
public function createAction(Request $request)
    {
        if ($this->get('session')->has('module')) {
            // get the last module from the session to fill some defaults for the new one
            $tmpModule = $this->get('session')->get('module');

            // setup a fresh module object
            $module = new Module();
            $module->setStyle($tmpModule->getStyle());
        }
        else {
            // setup a fresh module object
            $module = new Module();

            // fill it with some defaults
            $module->setStyle('less');
        }

        // create form
        $form = $this->createForm(new ModuleType(), $module);

        if ($request->getMethod() == 'POST') {
            $form->bindRequest($request);

            if ($form->isValid()) {
                // set default templates
                $module->addTemplate(strtolower($module->getName()));

                // save the module in the session
                $this->get('session')->set('module', $module);

                // create the module in the filesystem
                try {
                    $moduleManager = $this->get('terrific.composer.module.manager');
                    $moduleManager->createModule($module);

                    $this->get('session')->setFlash('notice', 'Module ' . ucfirst($module->getName()) . ' created successfully');
                }
                catch (\Exception $e) {
                    $logger = $this->get('logger');
                    $logger->err($e->getMessage());

                    $this->get('session')->setFlash('notice', 'Module could not be created: ' . $e->getMessage());
                }

                if ($request->get('addskin', false)) {
                    // redirect to the add skin form
                    return $this->redirect($this->generateUrl('composer_add_skin'));
                }
                else {
                    // redirect to the create module form
                    return $this->redirect($this->generateUrl('composer_create_module'));
                }
            }
        }

        return array('form' => $form->createView());
    }
1110158
public static function moduleClass($moduleName = 'Module')
    {
        $result = false;

        $className = get_called_class();
        $refClass = new ReflectionClass($className);
        $ns = $refClass->getNamespaceName();

        $len = strlen($ns) - strlen(UniModule::$modelsSubdir);
        if (strrpos($ns, UniModule::$modelsSubdir) == $len) {
           $ns = substr($ns, 0, $len);
           $result = $ns . $moduleName;
        }

        return $result;
    }
905042
protected function getRememberMeKeyFromCookie(Request $request, $cookieName)
    {
        $ctp = new CookieTokenProvider();

        return $ctp->getKeyFromCookie($request, $cookieName);
    }
550752
public function getRequiredModules($moduleName) {
        $moduleName = strtolower($moduleName);
        if (isset($this->_requiredModules[$moduleName])) {
            return $this->_requiredModules[$moduleName];
        }
        else {
            return null;
        }
    }
584112
public function getTags(Request $request, $className)
    {
        $context = array();

        $tagRepository = $this->em->getRepository($className);
        $context['tags'] = $tagRepository->findBy(array(), array('name' => 'ASC'));

        $searchTag = $request->get('tag') ? explode(',', $request->get('tag')) : null;
        if ($searchTag) {
            $context['activeTag'] = true;
            $context['activeTags'] = $searchTag;
        }

        return $context;
    }
208201
public function getModule($moduleName)
    {
        if (!$this->hasModule($moduleName)) {
            throw new ModuleException(__CLASS__, "Module $moduleName couldn't be connected");
        }

        return $this->modules[$moduleName];
    }
194439
public function listByModuleName($moduleName)
    {
        if ($this->primaryKeysSorted) {
            $this->lazySortPrimaryKeys();
        }

        return $this->map->listBySecondaryKey($moduleName);
    }
331287
private function processNormalQuery(Request $request, string $schemaName = null): array
    {
        $params = $this->requestParser->parse($request);

        return $this->requestExecutor->execute($schemaName, $params)->toArray();
    }
861576
protected function logRequest(Request $request)
    {
        $this->logger->log(LogLevel::DEBUG, '> '.$request->getMethod().' '.$request->getRequestUri());
    }
1049875
public function buildAssets($moduleName)
    {
        $module = $this->getModuleDirectory($moduleName);
        if ($module)
        {
            $module .= '/assets';
            if ($this->files->exists($module))
            {
                if (!@$this->files->copyDirectory($module, $this->getAssetDirectory($moduleName)))
                {
                    $this->errors->add('build_assets', 'Unable to build assets');
                    return false;
                }
            }
            return true;
        }
        return false;
    }
1299141
public function assignRequest(Request $request)
    {
        $extracted = $this->extractData($request);

        if (count($extracted)) {
            foreach ($this->getAttributeNames() as $key) {
                if (array_key_exists($key, $extracted)) {
                    $this->{$key} = $extracted[$key];
                }
            }
            return true;
        }

        return false;
    }
1373267
public function hasModule($name)
	{
	    $name = $this->parseModuleAlias($name);
	    
	    return isset($this->_modules) && in_array($name, $this->_modules);
	}
530363
protected function populateDataInModule(string $moduleName) : void
    {
        if ('' === $moduleName) {
            return;
        }

        if (in_array($moduleName, $this->skipModules)) {
            return;
        }

        $module = $this->getCSVModuleAttr($moduleName);

        if (empty($module)) {
            return;
        }

        $table = TableRegistry::get($moduleName);

        for ($count = 0; $count < $this->numberOfRecords; $count++) {
            $entity = $table->newEntity();

            $data = [];
            foreach ($module as $fieldName => $fieldData) {
                if (empty($fieldData['type'])) {
                    continue;
                }

                if ($this->isCombinedField($fieldData['type'])) {
                    $fields = $this->getCombinedFieldValueBasedOnType($fieldData['type'], '', (string)$fieldName);
                    foreach ($fields as $field => $value) {
                        $data[$field] = $value;
                    }
                    continue;
                }

                $fieldValue = $this->getFieldValueBasedOnType($fieldData['type']);
                if (empty($fieldValue)) {
                    continue;
                }
                $data[$fieldName] = $fieldValue;
            }
            $entity = $table->patchEntity($entity, $data);
            if ($table->save($entity)) {
                $id = $entity->id;
            }
        }
        $this->modulesPolpulatedWithData[] = $moduleName;
        $this->out($moduleName);
    }