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_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_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, 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 groupInfo(self): return IGSGroupInfo(self.group)
def set_admins_as_posting_members(self): groupInfo = IGSGroupInfo(self.group) admins = [a.id for a in groupInfo.group_admins] if admins: self.set_list_property(b'posting_members', admins)
def groupInfo_to_group(g): if IGSGroupInfo.providedBy(g): group = g.groupObj else: group = g return group