Fabriciojf.com Wiki
  • FAQ
    • APIs
      • FAQs Favoritos

        Qual é a sua dúvida?

        •  Página inicial do FAQ
        • Asterisk
        • Filtrando urls validas através do plugin acl no framework Fabriciojf.com

        Filtrando urls validas através do plugin acl no framework Fabriciojf.com

         

        Para filtrar apenas urls permitidas para o usuários corrente, utilize a função filterUrlsAllowed do help LayoutHelper

        Exemplo:

         array(
                'panel' => array(
                    'icon' => 'ion ion-chatboxes',
                    'title' => __('Agent Panel'),
                    'url' => array(
                        'admin' => true,
                        'controller' => 'chassi',
                        'action' => 'dashboard'
                    )
                )
            ),
            'Reports' => array(
                'index' => array(
                    'icon' => 'ion ion-grid',
                    'title' => sprintf(__('List %s'), __('Reports')),
                    'url' => array(
                        'admin' => true,
                        'controller' => 'reports',
                        'action' => 'index'
                    )
                ),
                'dashboard' => array(
                    'icon' => 'ion ion-easel',
                    'title' => __('Report Dashboard'),
                    'url' => array(
                        'admin' => true,
                        'controller' => 'reports',
                        'action' => 'dashboard'
                    )
                ),
                'add' => array(
                    'icon' => 'ion ion-plus-round',
                    'title' => sprintf(__('Add %s'), __('Report')),
                    'url' => array(
                        'admin' => true,
                        'controller' => 'reports',
                        'action' => 'add'
                    )
                ),
            ),
        );
        
        
        $output = $this->Layout->filterUrlsAllowed($urls); 
        

        O Output é um array contendo apenas as urls liberadas para o usuário, configurável através do módulo permissions do Framework. Ex:

        array(
        	'Agent' => array(
        		'panel' => array(
        			'icon' => 'ion ion-chatboxes',
        			'title' => 'Painel de Agente',
        			'url' => array(
        				'admin' => true,
        				'controller' => 'chassi',
        				'action' => 'dashboard'
        			)
        		)
        	),
        	'Reports' => array(
        		'index' => array(
        			'icon' => 'ion ion-grid',
        			'title' => 'Listar Relatórios',
        			'url' => array(
        				'admin' => true,
        				'controller' => 'reports',
        				'action' => 'index'
        			)
        		),
        	)
        );
        
         Página inicial do FAQ
        • FAQ
          • APIs
            • FAQs Favoritos

              © Copyright 2025 Fabriciojf.com  Criado por FábioCostaMKT   Pastes   Administração