Re: default roles for a dx.membrane user

"Jens W. Klein" <jens-/[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Organization Klein & Partner KG
Message-ID <[email protected]>
Ok, here for documentation (I implemented this for Peter):

On 2014-10-06 12:46, Peter Holzer wrote:
> I made a custom dexterity.membrane user but it just gets the
> authenticated role.
> Can someone point out the bits and pieces for the default Plone roles
> like Member, Reader, ...

with latest dexterity.membrane master:

roles.py:

# -*- coding: utf-8 -*-
from Products.membrane.interfaces import IMembraneUserRoles
from dexterity.membrane.behavior.membraneuser import DxUserObject
from dexterity.membrane.behavior.membraneuser import IMembraneUser
from zope.component import adapter
from zope.interface import implementer

DEFAULT_ROLES = ['Member']


@implementer(IMembraneUserRoles)
@adapter(IMembraneUser)
class MyDefaultRoles(DxUserObject):

     def getRolesForPrincipal(self, principal, request=None):
         return DEFAULT_ROLES

and configure.zcml:

<adapter
     factory=".roles.MyDefaultRoles"
     provides="Products.membrane.interfaces.IMembraneUserRoles"
/>

greets Jens
-- 
Klein & Partner KG, member of BlueDynamics Alliance


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.