Como sempre, estou mexendo no meu IDE. O desafio de hoje é configurar regras de ACL de nível de exibição para cada um dos vários gerentes (visualizações de lista/formulário) no meu componente de gerenciamento de teste.
Primeiro, adicionei as seções necessárias ao arquivo access.xml
<?xml version="1.0" encoding="UTF-8"?>
<access component="com_babelu_exams">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
</section>
<section name="category">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_CATEGORY_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_CATEGORY_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_CATEGORY_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_CATEGORY_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_CATEGORY_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_CATEGORY_DESC" />
</section>
<section name="level">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_LEVEL_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_LEVEL_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_LEVEL_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_LEVEL_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_LEVEL_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_LEVEL_DESC" />
</section>
<section name="exam">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_EXAM_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_EXAM_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_EXAM_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_EXAM_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_EXAM_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_EXAM_DESC" />
</section>
<section name="section">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_SECTION_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_SECTION_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_SECTION_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_SECTION_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_SECTION_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_SECTION_DESC" />
</section>
<section name="problem">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_PROBLEM_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_PROBLEM_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_PROBLEM_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_PROBLEM_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_PROBLEM_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_PROBLEM_DESC" />
</section>
<section name="result">
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_RESULT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_RESULT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_RESULT_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_RESULT_DESC" />
</section>
Em seguida, tentei adicioná-los ao meu config.xml no campo de permissões
<!-- SOF PERMISSIONS -->
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC"
label="JCONFIG_PERMISSIONS_LABEL">
<field name="rules" type="rules" component="com_babelu_exams"
filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL"
section="component" />
<field name="rules" type="rules" component="com_babelu_exams"
filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL"
section="category" />
</fieldset>
<!-- EOF PERMISSIONS -->
No entanto, isso não funcionou, pois as regras da categoria substituíram as regras do componente. Então eu tentei fazer das regras uma matriz
<!-- SOF PERMISSIONS -->
<fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC"
label="JCONFIG_PERMISSIONS_LABEL">
<field name="rules[]" type="rules" component="com_babelu_exams"
filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL"
section="component" />
<field name="rules[]" type="rules" component="com_babelu_exams"
filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL"
section="category" />
</fieldset>
<!-- EOF PERMISSIONS -->
mas isso teve o mesmo efeito. Então, tentei anexar a seção ao atributo component, mas isso fez com que todo o controle de permissões ficasse em branco.
Alguém sabe se o que estou tentando fazer é possível na exibição do componente com_config?
A razão pela qual desejo ter isso no nível do componente é porque estou tentando obter uma ACL em cascata completa. Onde no superadministrador pode definir a ACL para o componente -> a exibição -> o registro. O que me permitirá ocultar seções do componente que não são relativas às permissões de acesso dos usuários atuais.
Portanto, se você souber como isso pode ser feito usando com_config, informe-me. = ^ D Vou procurar uma solução nesse meio tempo, se eu a encontrar, postarei.
Feliz Joomla! Ng
Não tenho certeza se é um erro de digitação, mas o access.xml está ausente no fechamento </access>
tag.
Eu nunca tentei, mas acho que você não pode ter vários campos de permissões na mesma configuração.
component
é usada nas opções no nível do componente.category
one é usado por com_categories para as permissões de categoria única.com_content
você tem uma seção article
que é usada para definir as permissões de cada artigo individualmente.Se você precisar de uma ACL separada para cada exibição, precisará criar suas próprias regras de ACL e não usar as principais. Gostar com_babelu_exams.level.create
.