def reset_profile(event): """ Subscriber for IUserAddedGroup and IUserRemovedGroup events. o Find the profile corresponding to the user and update its ACL by resettings its security workflow """ if (not IUserAddedGroup.providedBy(event) and not IUserRemovedGroup.providedBy(event)): return profiles = find_profiles(event.site) profile = profiles.get(event.id) if profile is not None: reset_security_workflow(profile)
def user_joined_community(event): if IUserAddedGroup.providedBy(event): delta = event.groups - event.old_groups joined = [x for x in delta if x.startswith(MEMBER_PREFIX)] events = find_events(event.site) if not events or not joined: return profile = event.site["profiles"][event.id] for group in joined: community_id, gtype = group[len(MEMBER_PREFIX) :].split(":") if gtype == "members": community = event.site["communities"].get(community_id) if community is None: continue info = _getInfo(profile, community) info["flavor"] = "joined_left" info["operation"] = "joined" events.push(**info)
def user_joined_community(event): if IUserAddedGroup.providedBy(event): delta = event.groups - event.old_groups joined = [x for x in delta if x.startswith(MEMBER_PREFIX)] events = find_events(event.site) if not events or not joined: return profile = event.site['profiles'][event.id] for group in joined: community_id, gtype = group[len(MEMBER_PREFIX):].split(':') if gtype == 'members': community = event.site['communities'].get(community_id) if community is None: continue info = _getInfo(profile, community) info['flavor'] = 'joined_left' info['operation'] = 'joined' events.push(**info)