Re: [Product-Developers] How to display borg.localrole in Sharing tab
Sean Upton wrote: On Fri, Mar 23, 2012 at 3:11 PM, Marcos Romero marcos.rom...@inter-cultura.com wrote: I'm adding principals (users and groups) to existing roles programatically via borg.localrole. I'd like those principals to be shown under Can read, Can edit, Can review columns in the Sharing tab. I don't wont to add new roles there, just to see people who effectively have those roles, Override the sharing view to meet your needs, perhaps? Hi Marcos, did you eventually manage to find way to display borg.localroles on the sharing tab? I did follow follow Sean's idea on overriding the sharing view, actually monkeypatching plone.app.workflow.browser.sharing.SharingView._inherited_roles *) so that roles provided by borg.localrole adapter are shown as inherited roles. Maybe we could try to PLIP this into Plone on some day. Best Regards, Asko *) from Products.CMFCore.utils import getToolByName def _inherited_roles(self): # Get the default values: result = self._old__inherited_roles() # Get all local roles (includeding those provided # by borg_localroles) and editable local roles # (only those stored in the object): pas = getToolByName(self.context, acl_users) editable_local_roles = dict(self.context.get_local_roles()) # Calculate borg_local_roles by substracting editable local # roles from all available local roles (including the # borg_localrole provided roles): borg_local_roles = pas.getAllLocalRoles(self.context) for one_user, roles in editable_local_roles.items(): borg_local_roles[one_user] = filter(lambda x: x not in roles, borg_local_roles.get(one_user, ())) if not borg_local_roles[one_user]: del borg_local_roles[one_user] # Adapted from: PluggableAuthService._getLocalRolesForDisplay borg_result = [] for one_user in borg_local_roles.items(): username = userid = one_user[0] roles = one_user[1] userType = 'user' if pas.getGroup(userid): userType = 'group' else: user = pas.getUserById(userid) or pas.getUser(username) if user: username = user.getUserName() userid = user.getId() borg_result.append((username, tuple(roles), userType, userid)) return result + tuple(borg_result) ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers
Re: [Product-Developers] How to display borg.localrole in Sharing tab
On Fri, Mar 23, 2012 at 3:11 PM, Marcos Romero marcos.rom...@inter-cultura.com wrote: I'm adding principals (users and groups) to existing roles programatically via borg.localrole. I'd like those principals to be shown under Can read, Can edit, Can review columns in the Sharing tab. I don't wont to add new roles there, just to see people who effectively have those roles, Override the sharing view to meet your needs, perhaps? but not in the native way but via my custom adapter. Can you elaborate? As it stands now, any principals with existing local roles (that are also sharing page roles) will show up as rows in the sharing page grid. Do you mean that you have an ILocalRoleProvider adapter that stores the roles in a unconventional way that is somehow (??) in-accessible to the sharing tab? Exactly. *Marcos F. Romero* Responsable de Desarrollo Inter-Cultura marcos.rom...@inter-cultura.com mailto:marcos.rom...@inter-cultura.com www.inter-cultura.com http://www.inter-cultura.com/ +54 11 4542-8299 ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers
Re: [Product-Developers] How to display borg.localrole in Sharing tab
On Fri, Mar 23, 2012 at 3:11 PM, Marcos Romero marcos.rom...@inter-cultura.com wrote: I'm adding principals (users and groups) to existing roles programatically via borg.localrole. I'd like those principals to be shown under Can read, Can edit, Can review columns in the Sharing tab. I don't wont to add new roles there, just to see people who effectively have those roles, Override the sharing view to meet your needs, perhaps? but not in the native way but via my custom adapter. Can you elaborate? As it stands now, any principals with existing local roles (that are also sharing page roles) will show up as rows in the sharing page grid. Do you mean that you have an ILocalRoleProvider adapter that stores the roles in a unconventional way that is somehow (??) in-accessible to the sharing tab? Sean ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers
[Product-Developers] How to display borg.localrole in Sharing tab
Hi I'm adding localroles programatically via borg.localrole but principals (users and groups) aren't shown in the Sharing tab. Although I know it works, it would be really nice to *see* who can do what. Am I missing some configuration in my site settings? Regards -- *Marcos F. Romero* Responsable de Desarrollo Inter-Cultura marcos.rom...@inter-cultura.com mailto:marcos.rom...@inter-cultura.com www.inter-cultura.com http://www.inter-cultura.com/ +54 11 4542-8299 ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers
Re: [Product-Developers] How to display borg.localrole in Sharing tab
Thanks Jon I think I didn't explain it right. I'm adding principals (users and groups) to existing roles programatically via borg.localrole. I'd like those principals to be shown under Can read, Can edit, Can review columns in the Sharing tab. I don't wont to add new roles there, just to see people who effectively have those roles, but not in the native way but via my custom adapter. I hope this is more clear. Regards -- Marcos F. Romero Responsable de Desarrollo Inter-Cultura marcos.rom...@inter-cultura.com www.inter-cultura.com +54 11 4542-8299 On Fri, Mar 23, 2012 at 5:54 PM, Jon Stahl jonst...@gmail.com wrote: I believe this is documented at: http://plone.org/documentation/manual/developer-manual/generic-setup/reference/sharing-ref :jon On Fri, Mar 23, 2012 at 7:46 AM, Marcos Romero marcos.rom...@inter-cultura.com wrote: Hi I'm adding localroles programatically via borg.localrole but principals (users and groups) aren't shown in the Sharing tab. Although I know it works, it would be really nice to *see* who can do what. Am I missing some configuration in my site settings? Regards -- Marcos F. Romero Responsable de Desarrollo Inter-Cultura marcos.rom...@inter-cultura.com www.inter-cultura.com +54 11 4542-8299 ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers
Re: [Product-Developers] How to display borg.localrole in Sharing tab
On 3/23/12 2:11 PM, Marcos Romero wrote: Thanks Jon I think I didn't explain it right. I'm adding principals (users and groups) to existing roles programatically via borg.localrole. I'd like those principals to be shown under Can read, Can edit, Can review columns in the Sharing tab. I don't wont to add new roles there, just to see people who effectively have those roles, but not in the native way but via my custom adapter. I hope this is more clear. I think the lack of this is a shortcoming in the existing sharing tab, and a patch to improve it would be welcome! -- David Glick Web Developer davidgl...@groundwire.org 206.286.1235x32 The Engagement Party 2012. So much more fun than the wedding reception. http://www.npoengagementparty.com ___ Product-Developers mailing list product-develop...@lists.plone.org https://lists.plone.org/mailman/listinfo/plone-product-developers