def user_participation_coach_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), '%s is not a IGSUserInfo' % \
        userInfo
    assert IGSGroupInfo.providedBy(groupInfo)
    ptnCoachId = groupInfo.get_property('ptn_coach_id', '')
    retval = (user_member_of_group(userInfo, groupInfo)
              and (userInfo.id == ptnCoachId))
    assert type(retval) == bool
    return retval
def user_participation_coach_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), '%s is not a IGSUserInfo' % \
        userInfo
    assert IGSGroupInfo.providedBy(groupInfo)
    ptnCoachId = groupInfo.get_property('ptn_coach_id', '')
    retval = (user_member_of_group(userInfo, groupInfo)
              and (userInfo.id == ptnCoachId))
    assert type(retval) == bool
    return retval
def user_blocked_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not an IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    mlistInfo = createObject('groupserver.MailingListInfo', context)
    retval = (user_member_of_group(userInfo, groupInfo)
              and (userInfo.id in [m.id for m in mlistInfo.blocked_members]))
    assert type(retval) == bool
    return retval
def user_invited_member_of_group(userInfo, groupInfo, siteInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not a IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    invited_group_members = \
        InvitedGroupMembers(context, siteInfo).members
    retval = userInfo.id in [m.id for m in invited_group_members]
    assert type(retval) == bool
    return retval
def user_posting_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not an IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    mlistInfo = IGSMailingListInfo(context)
    retval = (user_member_of_group(userInfo, groupInfo) and
              (userInfo.id in [m.id for m in mlistInfo.posting_members]))
    assert type(retval) == bool
    return retval
def user_blocked_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not an IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    mlistInfo = createObject('groupserver.MailingListInfo', context)
    retval = (user_member_of_group(userInfo, groupInfo) and
              (userInfo.id in [m.id for m in mlistInfo.blocked_members]))
    assert type(retval) == bool
    return retval
def user_invited_member_of_group(userInfo, groupInfo, siteInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not a IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    invited_group_members = \
        InvitedGroupMembers(context, siteInfo).members
    retval = userInfo.id in [m.id for m in invited_group_members]
    assert type(retval) == bool
    return retval
def user_posting_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not an IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    mlistInfo = IGSMailingListInfo(context)
    retval = (user_member_of_group(userInfo, groupInfo)
              and (userInfo.id in [m.id for m in mlistInfo.posting_members]))
    assert type(retval) == bool
    return retval
def user_unverified_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not a IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    unverified_group_members = \
        get_unverified_group_users(context, groupInfo.id)
    retval = (user_member_of_group(userInfo, groupInfo) and
              (userInfo.id in [m.getId() for m in unverified_group_members]))
    assert type(retval) == bool
    return retval
    def __init__(self, context):
        self.context = context
        # the context we are passed might already be a userinfo
        if IGSUserInfo.providedBy(context):
            self.userInfo = context
        else:
            self.userInfo = createObject('groupserver.LoggedInUser', context)

        emailUser = EmailUser(self.userInfo.user, self.userInfo)
        defaultAddresses = emailUser.get_delivery_addresses()
        self.defaultAddress = ''
        if defaultAddresses:
            self.defaultAddress = defaultAddresses[0]
def user_unverified_member_of_group(userInfo, groupInfo):
    assert IGSUserInfo.providedBy(userInfo), \
        '%s is not a IGSUserInfo' % userInfo
    assert IGSGroupInfo.providedBy(groupInfo), \
        '%s is not an IGSGroupInfo' % groupInfo
    context = groupInfo.groupObj
    unverified_group_members = \
        get_unverified_group_users(context, groupInfo.id)
    retval = (user_member_of_group(userInfo, groupInfo) and
              (userInfo.id in [m.getId()
                               for m in unverified_group_members]))
    assert type(retval) == bool
    return retval
Exemplo n.º 12
0
    def __init__(self, group, userInfo):
        assert IGSGroupFolder.providedBy(group),\
          u'%s is not a group folder' % group
        assert IGSUserInfo.providedBy(userInfo),\
          u'%s is not a user-info' % userInfo

        self.site_root = group.site_root()
        self.userInfo = userInfo
        self.groupInfo = IGSGroupInfo(group)

        self.__status = None
        self.__statusNum = 0
        self.__canPost = None
        self.__profileInterfaces = None
    def __init__(self, context):
        self.context = context
        # the context we are passed might already be a userinfo
        if IGSUserInfo.providedBy(context):
            self.userInfo = context
        else:
            self.userInfo = createObject('groupserver.LoggedInUser',
                                         context)

        emailUser = EmailUser(self.userInfo.user, self.userInfo)
        defaultAddresses = emailUser.get_delivery_addresses()
        self.defaultAddress = ''
        if defaultAddresses:
            self.defaultAddress = defaultAddresses[0]
Exemplo n.º 14
0
    def __init__(self, group, userInfo):
        assert IGSGroupFolder.providedBy(group),\
          u'%s is not a group folder' % group
        assert IGSUserInfo.providedBy(userInfo),\
          u'%s is not a user-info' % userInfo

        self.site_root = group.site_root()
        self.userInfo = userInfo
        self.groupInfo = IGSGroupInfo(group)

        self.__status = None
        self.__statusNum = 0
        self.__canPost = None
        self.__profileInterfaces = None
Exemplo n.º 15
0
    def __init__(self, siteInfo, user):
        if not siteInfo:
            m = 'No siteInfo'
            raise ValueError(m)
        self.siteInfo = siteInfo

        if not user:
            m = 'No userInfo'
            raise ValueError(m)
        if IGSUserInfo.providedBy(user):
            self.userInfo = user
        else:
            self.userInfo = IGSUserInfo(user)

        self.queries = AuditQuery()
        self.factory = AuditEventFactory()
    def __init__(self, userInfo, membersInfo):
        assert IGSUserInfo.providedBy(userInfo), \
          u'%s is not a GSUserInfo' % userInfo
        assert IGSGroupMembersInfo.providedBy(membersInfo), \
          u'%s is not a GSGroupMembersInfo' % membersInfo

        self.userInfo = userInfo
        self.membersInfo = membersInfo
        self.groupInfo = membersInfo.groupInfo
        self.siteInfo = membersInfo.siteInfo
        self.groupIsModerated = membersInfo.mlistInfo.is_moderated
        self.postingIsSpecial = (self.groupInfo.group_type == 'announcement')
        self.numPostingMembers = len(membersInfo.postingMembers)

        self.__status_label = self.__isNormalMember = None
        self.__isSiteAdmin = self.__isGroupAdmin = None
        self.__isPtnCoach = self.__isPostingMember = None
        self.__isModerator = self.__isModerated = None
        self.__isBlocked = self.__isInvited = None
        self.__isMember = self.__isFullMember = None
        self.__isConfused = self.__isOddlyConfigured = None
        self.__isUnverified = None
Exemplo n.º 17
0
    def __init__(self, userInfo, membersInfo):
        assert IGSUserInfo.providedBy(userInfo), \
          u'%s is not a GSUserInfo' % userInfo
        assert IGSGroupMembersInfo.providedBy(membersInfo), \
          u'%s is not a GSGroupMembersInfo' % membersInfo

        self.userInfo = userInfo
        self.membersInfo = membersInfo
        self.groupInfo = membersInfo.groupInfo
        self.siteInfo = membersInfo.siteInfo
        self.groupIsModerated = membersInfo.mlistInfo.is_moderated
        self.postingIsSpecial = (self.groupInfo.group_type == 'announcement')
        self.numPostingMembers = len(membersInfo.postingMembers)

        self.__status_label = self.__isNormalMember = None
        self.__isSiteAdmin = self.__isGroupAdmin = None
        self.__isPtnCoach = self.__isPostingMember = None
        self.__isModerator = self.__isModerated = None
        self.__isBlocked = self.__isInvited = None
        self.__isMember = self.__isFullMember = None
        self.__isConfused = self.__isOddlyConfigured = None
        self.__isUnverified = None
def userInfo_to_user(u):
    if IGSUserInfo.providedBy(u):
        user = u.user
    else:
        user = u
    return user
def userInfo_to_user(u):
    if IGSUserInfo.providedBy(u):
        user = u.user
    else:
        user = u
    return user