Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
def user_left_community(event):
    if IUserRemovedGroup.providedBy(event):
        delta = event.old_groups - event.groups
        left = [x for x in delta if x.startswith(MEMBER_PREFIX)]
        events = find_events(event.site)
        if not events or not left:
            return
        profile = event.site["profiles"][event.id]
        for group in left:
            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"] = "left"
                events.push(**info)
Exemple #4
0
def user_left_community(event):
    if IUserRemovedGroup.providedBy(event):
        delta = event.old_groups - event.groups
        left = [x for x in delta if x.startswith(MEMBER_PREFIX)]
        events = find_events(event.site)
        if not events or not left:
            return
        profile = event.site['profiles'][event.id]
        for group in left:
            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'] = 'left'
                events.push(**info)