Sean Fulmer wrote:

[..]

    portal=getToolByName(self,'portal_url').getPortalObject()
    roles=list(portal.__ac_roles__)
    for role in ('CustomRole1','CustomRole2',):
        if role not in roles:
            roles.append(role)
    portal.__ac_roles__=tuple(roles)

Don't really know if it will work for you, but I guess it's worth a shot :)


Yup. Or somewhat shorter:

def addRole(self, out, role):
    if role not in self.__ac_roles__:
        self._addRole(role)
        out.write("Added the '%s' role to the portal.\n" % role)

That's at least how I did it here:

http://svn.plone.org/svn/collective/LockingWorkflow/trunk/Extensions/Install.py

Raphael

--
Sean


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to