Re: r21357 - in plone.app.workflow/trunk: docs plone/app/workflow/browser

1 Message Forum Options Options
Permalink
Laurence Rowe
Re: r21357 - in plone.app.workflow/trunk: docs plone/app/workflow/browser
Reply Threaded More
Print post
Permalink
This change introduces a bug whereby the checkboxes are blanked if a
role is given to anything other than the Logged-in users group.

Steps to reproduce:

Search for admin

give administrators group the view role

save form

All check boxes unchecked.

Laurence


Wichert Akkerman wrote:

> Author: wichert
> Date: Wed Jul  2 13:12:07 2008
> New Revision: 21357
>
> Modified:
>    plone.app.workflow/trunk/docs/HISTORY.txt
>    plone.app.workflow/trunk/plone/app/workflow/browser/kss_sharing.py
>    plone.app.workflow/trunk/plone/app/workflow/browser/sharing.py
> Log:
> Modify the inline (kss) search option in the sharing page to only search
> and not both update the roles and search. This behaviour was unintuitive and
> possible very very slow.
>
>
> Modified: plone.app.workflow/trunk/docs/HISTORY.txt
> ==============================================================================
> --- plone.app.workflow/trunk/docs/HISTORY.txt (original)
> +++ plone.app.workflow/trunk/docs/HISTORY.txt Wed Jul  2 13:12:07 2008
> @@ -4,6 +4,11 @@
>  1.1.1 - UNRELEASED
>  ------------------
>  
> +- Modify the inline (kss) search option in the sharing page to only search
> +  and not update the roles and search. This behaviour was unintuitive and
> +  possible very very slow.
> +  [wichert]
> +
>  - Update the sharing page to do nothing if the new set of roles is the
>    same as the current set of roles.
>    [wichert]
>
> Modified: plone.app.workflow/trunk/plone/app/workflow/browser/kss_sharing.py
> ==============================================================================
> --- plone.app.workflow/trunk/plone/app/workflow/browser/kss_sharing.py (original)
> +++ plone.app.workflow/trunk/plone/app/workflow/browser/kss_sharing.py Wed Jul  2 13:12:07 2008
> @@ -1,4 +1,3 @@
> -from Acquisition import aq_inner
>  from zope.interface import implements
>  from zope.component import getMultiAdapter
>  
> @@ -17,32 +16,8 @@
>      macro_wrapper = ViewPageTemplateFile('macro_wrapper.pt')
>      
>      def updateSharingInfo(self, search_term=''):
> -
>          sharing = getMultiAdapter((self.context, self.request,), name="sharing")
>      
> -        inherit = bool(self.request.form.get('inherit', False))
> -        reindex = sharing.update_inherit(inherit, reindex=False)
> -        
> -        # Extract currently selected setting from the form
> -        # to take these into account (also on re-submit of the form).
> -        entries = self.request.form.get('entries', [])
> -        
> -        roles = [r['id'] for r in sharing.roles()]
> -        settings = []
> -        for entry in entries:
> -            settings.append(
> -                dict(id = entry['id'],
> -                     type = entry['type'],
> -                     roles = [r for r in roles if entry.get('role_%s' % r, False)]))
> -        if settings:
> -            reindex = sharing.update_role_settings(settings) or reindex
> -
> -        if reindex:
> -            aq_inner(self.context).reindexObjectSecurity()
> -
> -        # get the table body, let it render again
> -        # use macro in sharing.pt for that
> -
>          # get the html from a macro
>          ksscore = self.getCommandSet('core')
>  
>
> Modified: plone.app.workflow/trunk/plone/app/workflow/browser/sharing.py
> ==============================================================================
> --- plone.app.workflow/trunk/plone/app/workflow/browser/sharing.py (original)
> +++ plone.app.workflow/trunk/plone/app/workflow/browser/sharing.py Wed Jul  2 13:12:07 2008
> @@ -140,8 +140,28 @@
>          user_results = self.user_search_results()
>          group_results = self.group_search_results()
>  
> -        return existing_settings + user_results + group_results
> -        
> +        current_settings = existing_settings + user_results + group_results
> +
> +        # We may be called when the user does a search instead of an update.
> +        # In that case we must not loose the changes the user made and
> +        # merge those into the role settings.
> +        requested = self.request.form.get('entries', None)
> +        if requested is not None:
> +            roles = [r['id'] for r in self.roles()]
> +            settings = {}
> +            for entry in requested:
> +                roles = [r for r in roles if entry.get('role_%s' % r, False)]
> +                settings[(entry['id'], entry['type'])] = roles
> +
> +            for entry in current_settings:
> +                desired_roles = settings.get((entry['id'], entry['type']), None)
> +                if desired_roles is None:
> +                    continue
> +                for role in entry["roles"]:
> +                    entry["roles"][role] = role in desired_roles
> +
> +        return current_settings
> +
>      def inherited(self, context=None):
>          """Return True if local roles are inherited here.
>          """
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers