[PLIP-Advisories] Re: [Plone] #9263: GenericSetup syntax for importing Sharing page roles

plip-advisories at lists.plone.org plip-advisories at lists.plone.org
Fri Dec 25 16:55:16 UTC 2009


#9263: GenericSetup syntax for importing Sharing page roles
----------------------------+-----------------------------------------------
 Reporter:  optilude        |        Owner:  optilude
     Type:  PLIP            |       Status:  closed  
 Priority:  major           |    Milestone:  4.0     
Component:  Infrastructure  |   Resolution:  fixed   
 Keywords:                  |  
----------------------------+-----------------------------------------------

Comment(by dukebody):

 I've tried to add remove="True" support to this feature. In
 plone.app.workflow/exportimport.py:
 {{{
 Index: exportimport.py
 ===================================================================
 --- exportimport.py     (revision 32656)
 +++ exportimport.py     (working copy)
 @@ -75,6 +75,13 @@

          component = PersistentSharingPageRole(title=title,
 required_permission=required)

 +        if node.hasAttribute('remove'):
 +            if self.context.queryUtility(component, ISharingPageRole,
 name) is not None:
 +                if name in self.context.objectIds():
 +                    self.context._delObject(name, suppress_events=True)
 +                    self.context.unregisterUtility(component,
 ISharingPageRole, name)
 +            return
 +
          self.context.registerUtility(component, ISharingPageRole, name,
 info=self.info_tag)

      def _extractRole(self, reg):

 }}}
 This makes
 {{{
 <?xml version="1.0"?>
 <sharing>
   <role
      remove="True"
      id="Overlord"
      title="Can fly"
      permission="Manage portal"
      i18n:attributes="title"
      />
 </sharing>
 }}}
 remove "Can fly" from the sharing page.

 I have no previous experience at all hacking GS import handlers so feel
 free to criticise.

-- 
Ticket URL: <http://dev.plone.org/plone/ticket/9263#comment:31>
Plone <http://plone.org>
Plone Content Management System


More information about the PLIP-Advisories mailing list