products/CPSSubscriptions

changeset 1095:7b96a4c82c30

General merge from 3.5 branch
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Sat, 29 Sep 2012 11:42:22 +0200
parents a926a69c1c81 9c7b9f143a85
children 0bc10111bf74
files .hgtags CHANGES HISTORY VERSION
diffstat 3 files changed, 33 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/.hgtags
     1.2 +++ b/.hgtags
     1.3 @@ -77,3 +77,4 @@
     1.4  0b34cc150e1b675349cd255771c49240ac96c97a 1.4.0-CPS-3.5
     1.5  adfd807f4dbddf589fde8b097d1693db1c9d6509 1.4.1-CPS-3.5
     1.6  644f11ef22228e80bc5ca9f1d365e5ff1d2f425a 1.5.0
     1.7 +9c9ad51dd327b44dfaf8718abb9d3f6bd4407848 1.4.2-CPS-3.5
     2.1 --- a/HISTORY
     2.2 +++ b/HISTORY
     2.3 @@ -16,6 +16,23 @@
     2.4  - 
     2.5  
     2.6  ===========================================================
     2.7 +Package: CPSSubscriptions 1.4.2-CPS-3.5
     2.8 +===========================================================
     2.9 +First release built by: gracinet at: 2012-09-18T18:14:35
    2.10 +Requires
    2.11 +~~~~~~~~
    2.12 +-
    2.13 +New features
    2.14 +~~~~~~~~~~~~
    2.15 +-
    2.16 +Bug fixes
    2.17 +~~~~~~~~~
    2.18 +- #2568: Filtering by groups in manual notification users search
    2.19 +New internal features
    2.20 +~~~~~~~~~~~~~~~~~~~~~
    2.21 +- 
    2.22 +
    2.23 +===========================================================
    2.24  Package: CPSSubscriptions 1.4.1-CPS-3.5
    2.25  ===========================================================
    2.26  First release built by: gracinet at: 2011-11-23T19:59:06
     3.1 --- a/skins/cps_subscriptions/content_notify_email_do_search_results.py
     3.2 +++ b/skins/cps_subscriptions/content_notify_email_do_search_results.py
     3.3 @@ -1,5 +1,8 @@
     3.4  ##parameters=dir, datastructure, **kw
     3.5  
     3.6 +import logging
     3.7 +logger = logging.getLogger('Products.CPSSubscriptions.notify')
     3.8 +
     3.9  datamodel = datastructure.getDataModel()
    3.10  
    3.11  original_mapping = {}
    3.12 @@ -35,27 +38,35 @@
    3.13      dict_roles = mtool.getMergedLocalRoles(call_context, withgroups=0)
    3.14      search_restricted_list = dict_roles.keys()
    3.15      users_mapping[dir.id_field] = search_restricted_list
    3.16 +
    3.17 +logger.info("users_mapping %r", users_mapping)
    3.18  results = dir.searchEntries(return_fields=return_fields, **users_mapping)
    3.19 +logger.info("results %r", results)
    3.20 +
    3.21  
    3.22  #
    3.23  # Check if there's groups with local roles
    3.24  #
    3.25  
    3.26  dict_roles = mtool.getMergedLocalRoles(call_context, withgroups=1)
    3.27 -groups = [x[len('group:'):] for x in dict_roles if x.startswith('group:')]
    3.28 +groups_with_roles = [x[len('group:'):] for x in dict_roles if x.startswith('group:')]
    3.29  
    3.30  # special handling of special groups to behave as the RecipientRules logic
    3.31 -if "role:Authenticated" in groups and not aclu.is_role_authenticated_empty:
    3.32 +if "role:Authenticated" in groups_with_roles and not aclu.is_role_authenticated_empty:
    3.33      results = dir.searchEntries(return_fields=return_fields, **original_mapping)
    3.34      skip_groups = True
    3.35 -elif "role:Anonymous" in groups and not aclu.is_role_anonymous_empty:
    3.36 +elif "role:Anonymous" in groups_with_roles and not aclu.is_role_anonymous_empty:
    3.37      results = dir.searchEntries(return_fields=return_fields, **original_mapping)
    3.38      skip_groups = True
    3.39  else:
    3.40      skip_groups = False
    3.41  
    3.42 +# GR there are problems with sets in skin scripts
    3.43 +wanted_groups = original_mapping.get('groups', ())
    3.44  if not skip_groups:
    3.45 -    for group_id  in groups:
    3.46 +    for group_id in groups_with_roles:
    3.47 +        if not group_id in wanted_groups:
    3.48 +            continue
    3.49          group_mapping = original_mapping.copy()
    3.50          group_mapping['groups'] = [group_id]
    3.51          group_member_results = dir.searchEntries(return_fields=return_fields,