Hi Fabio,

The workflow is one way to do it. However, generally it is hard to give the 
user good feedback via the workflow in Magnolia 4.4... and working with the 
OpenWFE based Workflow engine is just horrible. And it still means the user can 
see and choose "Activate" from the Menus, even though she doesn't actually have 
permissions to do so...

So I would go another way:

Another way to do it is to override the AdminTreeConfiguration object for your 
tree, and substitute it with your own implementation.
You can configure the tree-config class in the configuration, for example for 
the "website" tree under: 
/modules/adminInterface/trees/website/configurationClass

Create your own implementation as a subclass of 
info.magnolia.module.workflow.trees.WorkflowWebsiteTreeConfiguration and 
override the prepareContextMenu() method. You can then do something like:

ContextMenu menu = tree.getMenu();
Iterator<ContextMenuItem> it = menu.getMenuItems().iterator();
while (it.hasNext()){
        // remove unwanted items
        ContextMenuItem item = it.next();
        if (item==null) continue;
        String name = item.getName();
        if ( ("activate".equals(name) && 
!MgnlContext.getUser().hasRole("superuser") ) { // use any role you want
                it.remove();
        }
}

IMHO this is a better solution than putting it in the workflow because the user 
doesn't even get to see the menu items she can't use...

Note: If you're paranoid (or have editors that can't be trusted) you still need 
to put a check in the activation command chain (or the Workflow) to prevent 
malicious editors from invoking the function by way of hacking in their browser.

Regards from Vienna,

Richard


> -----Ursprüngliche Nachricht-----
> Von: [email protected] [mailto:user-list-owner@magnolia-
> cms.com] Im Auftrag von Nils Breunese
> Gesendet: Freitag, 06. März 2015 11:36
> An: Magnolia User-List
> Betreff: Re: [magnolia-user] Deny Activation of edited pages
> 
> 
> Fabio Paroni wrote:
> 
> > is it possible to create a role that let user edit magnolia pages, but 
> > denies
> the activation?
> > Magnolia 4.4.6 CE
> 
> This is something you'd implement via workflow. 4.4 uses OpenWFE for this,
> just like 4.5, so I guess the documentation for 4.5 applies:
> https://documentation.magnolia-cms.com/display/DOCS45/Workflow
> 
> Nils.
> 
> ----------------------------------------------------------------
> Alternatively, use our forums: http://forum.magnolia-cms.com/ To
> unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to