## Script (Python) "group_memberships" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=groups_object, user_id=None ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use Products.GSGroupMember instead.") group_object = {} user = user_id and groups_object.acl_users.getUser( user_id) or context.REQUEST.AUTHENTICATED_USER objects = context.Scripts.get.object_values(groups_object, ['Folder']) for object in objects: if object and 'GroupMember' in user.getRolesInContext(object): group_template = object.getProperty('group_template', 'unknown') group_object.setdefault(group_template, []).append(object) return group_object
## Script (Python) "object_values" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=ocontainer, otypes=() ##title= ## # Basically a wrapped version of OFS.objectValues -- only # return objects we are actually allowed to see from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use OFS.objectValues instead.") objects = [] if not ocontainer: return objects for object_id in ocontainer.objectIds(otypes): try: object = getattr(ocontainer, object_id) objects.append(object) except: pass return objects
## Script (Python) "division_object" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use Products.GSContent.siteInfo instead.") # try to get the division object directly, without traversal division_object = context.restrictedTraverse( '/'.join(context.REQUEST.VirtualRootPhysicalPath)) if division_object: return division_object # otherwise, fallback division_object = context while division_object: try: in_division = division_object.getProperty('is_division') if in_division: break except AttributeError: pass division_object = division_object.aq_parent return division_object.aq_explicit
## Script (Python) "groups_object" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use gs.groups.base instead.") try: division_object = context.Scripts.get.division_object() groups_object = division_object.groups except: groups_object = context found = False while groups_object: try: if getattr(groups_object.aq_explicit, 'is_groups', 0): found = True break groups_object = groups_object.aq_parent except: break if found: return groups_object.aq_inner.aq_explicit return None
## Script (Python) "group_by_id" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=group_id ##title= ## # # This is a Manager level script, designed to be run with elevated # priviledges. Do not allow to be run as a non-Manager user. # from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use Products.GSGroup.groupInfo instead.") divisions = context.Scripts.get_unrestricted_division_objects() group = None for division in divisions: groups = getattr(division, 'groups', None) if groups and getattr(groups, 'is_groups', None): group = getattr(groups, group_id, None) if group and getattr(group, 'is_group', None): return group return group
## Script (Python) "option" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=key, default=None, include_user_setting=True ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script) site_root = context.site_root() user = context.REQUEST.AUTHENTICATED_USER global_config = getattr(context, 'GlobalConfiguration', None) division_config = getattr(context, 'DivisionConfiguration', None) retval = None setting_locations = [division_config] if include_user_setting: setting_locations.insert(0, user) for config in setting_locations: try: value = config.getProperty(key, None) if value != None: retval = value break except: pass
## Script (Python) "group_memberships" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=groups_object, user_id=None ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use Products.GSGroupMember instead.") group_object = {} user = user_id and groups_object.acl_users.getUser(user_id) or context.REQUEST.AUTHENTICATED_USER objects = context.Scripts.get.object_values(groups_object, ['Folder']) for object in objects: if object and 'GroupMember' in user.getRolesInContext(object): group_template = object.getProperty('group_template', 'unknown') group_object.setdefault(group_template, []).append(object) return group_object
## Script (Python) "sectionId" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## from Products.XWFCore.XWFUtils import deprecated deprecated(context, script, "Use something sane instead.") return getattr(context, 'section_id', 'home')