You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Renaud Richardet <re...@wyona.com> on 2005/11/16 02:50:15 UTC

modify menus, and allow only users with admin rights to access them

Hello,

I would like to modify the look of the menus, and allow only users with
admin rights to be allowed to create a specific ressource type, so
that's what I tried:

In mypub/config/menu/generics.xsp, I added:

    <menus>
      <menu i18n:attr="name" name="File">
        <block admin="false">
          <item uc:usecase="site.create" wf:event="mydoctype"
href="?doctype=mydoctype"><i18n:text>New MyDoctype</i18n:text></item>
        </block>
     </menu>     

And then in mypub/config/workflow/workflow.xml :

<transition source="authoring" destination="authoring">
    <event id="mydoctype"/>
    <condition
class="org.apache.lenya.cms.workflow.RoleCondition">admin</condition>
  </transition>
 
I also tried to add in mypub/config/ac/usecase-policies.xml

    <usecase id="mydoctype">
        <role id="admin"/>
    </usecase>

But it doesn't work :-( I read the 1.2 doc [1], but didn't get
enlighted. Does somebody have a hint?

Thanks,
Renaud

[1] http://lenya.apache.org/1_2_x/components/accesscontrol/authorizers.html


-- 
Renaud Richardet
COO America
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
office +1 857 776-3195                     mobile +1 617 230 9112
renaud.richardet@wyona.com                   http://www.wyona.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: modify menus, and allow only users with admin rights to access them

Posted by Andreas Hartmann <an...@apache.org>.
Renaud Richardet wrote:
> Hello,
> 
> I would like to modify the look of the menus, and allow only users with
> admin rights to be allowed to create a specific ressource type, so
> that's what I tried:
> 
> In mypub/config/menu/generics.xsp, I added:
> 
>     <menus>
>       <menu i18n:attr="name" name="File">
>         <block admin="false">
>           <item uc:usecase="site.create" wf:event="mydoctype"
> href="?doctype=mydoctype"><i18n:text>New MyDoctype</i18n:text></item>
>         </block>
>      </menu>     


The workflow authorization doesn't help here, because it applies to the
*current* document and not the document to be created.

Instead, you can declare a custom usecase (patch cocoon.xconf)
and use it in the menu:

  <item uc:usecase="site.create.mydoctype"
   href="?doctype=mydoctype"><i18n:text>New MyDoctype</i18n:text></item>


Now you can protect it in usecase-policies.xml:

   <usecase id="site.create.mydoctype">
     <role id="admin"/>
   </usecase>


HTH,
-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org