def get_auditor_inviter(self): ctx = get_the_actual_instance_from_zope(self.context) inviter = Inviter(ctx, self.request, self.userInfo, self.adminInfo, self.siteInfo, self.groupInfo) auditor = Auditor(self.siteInfo, self.groupInfo, self.adminInfo, self.userInfo) return (auditor, inviter)
def update(self): self.__updated = True self.messageQuery = MessageQuery(self.context) ctx = get_the_actual_instance_from_zope(self.view.context) self.groupsInfo = createObject('groupserver.GroupsInfo', ctx) self.searchTokens = createObject('groupserver.SearchTextTokens', self.s) groupIds = [gId for gId in self.g if gId] user = self.loggedInUser.user memberGroupIds = [] if self.mg and user.getId(): mg = self.groupsInfo.get_member_groups_for_user(user, user) memberGroupIds = [g.getId() for g in mg] if groupIds: if memberGroupIds: groupIds = [ gId for gId in self.groupIds if gId in memberGroupIds ] else: groupIds = self.groupsInfo.filter_visible_group_ids(groupIds) else: if memberGroupIds: groupIds = memberGroupIds else: groupIds = self.groupsInfo.get_visible_group_ids() try: topics = self.messageQuery.topic_search_keyword( self.searchTokens, self.siteInfo.get_id(), groupIds, limit=self.l + 1, offset=self.i) except SQLAlchemyError: log.exception("A problem occurred with a message query:") self.__searchFailed = True return else: self.__searchFailed = False # important: we short circuit here because if we have no matching # topics several of the remaining queries are *very* intensive if not topics: self.moreTopics = False self.topics = [] tIds = [] self.topicFiles = [] self.topicsWordCounts = [] else: self.moreTopics = (len(topics) == (self.l + 1)) self.topics = topics[:self.l] tIds = [t['topic_id'] for t in self.topics] self.topicFiles = self.messageQuery.files_metadata_topic(tIds)
def handle_change(self, action, data): ctx = get_the_actual_instance_from_zope(self.context) form.applyChanges(ctx, self.form_fields, data) auditor = ChangeAuditor(ctx) auditor.info(CHANGE, str(len(data['introduction']))) self.status = _( 'change-success', 'The introduction text that appears on ' '<a href="/">the site homepage</a> has been ' 'changed.')
def get_auditor_inviter(self, userInfo): """Retrives the Inviter and Auditor objects that will be used to invite the user. :param userInfo: The user who will be invited. :type userInfo: :class:`Products.CustomUserFolder.interfaces.IGSUserInfo` :returns: A 2-tuple ``(Auditor, Inviter)`` :rtype: tuple""" ctx = get_the_actual_instance_from_zope(self.context) inviter = Inviter(ctx, self.request, userInfo, self.invitingUserInfo, self.siteInfo, self.groupInfo) auditor = Auditor(self.siteInfo, self.groupInfo, self.invitingUserInfo, userInfo) return (auditor, inviter)
def get_auditor_inviter(self, userInfo): """Retrives the Inviter and Auditor objects that will be used to invite the user. :param userInfo: The user who will be invited. :type userInfo: :class:`Products.CustomUserFolder.interfaces.IGSUserInfo` :returns: A 2-tuple ``(Auditor, Inviter)`` :rtype: tuple""" ctx = get_the_actual_instance_from_zope(self.context) inviter = Inviter(ctx, self.request, userInfo, self.invitingUserInfo, self.siteInfo, self.groupInfo) auditor = Auditor(self.siteInfo, self.groupInfo, self.invitingUserInfo, userInfo) return (auditor, inviter)
def set_group_privacy(self, group, groupPrivacy): # Set the privacy: Which must be done **AFTER** the folder is # made into a group if ((not hasattr(group, 'is_group')) or (not group.is_group)): raise TypeError('The group does not appear to be a group.') if not hasattr(group, 'messages'): raise AttributeError('No messages in the group.') g = get_the_actual_instance_from_zope(group) assert g gi = GSGroupInfo(g) assert gi.groupObj privacyChanger = IGSChangePrivacy(gi) if groupPrivacy == 'public': privacyChanger.set_group_public() elif groupPrivacy == 'private': privacyChanger.set_group_private() else: privacyChanger.set_group_secret()
def handle_invite(self, action, data): for userId in data['site_members']: ctx = get_the_actual_instance_from_zope(self.context) userInfo = createObject('groupserver.UserFromId', ctx, userId) inviter = Inviter(ctx, self.request, userInfo, self.adminInfo, self.siteInfo, self.groupInfo) inviteId = inviter.create_invitation(data, False) auditor = Auditor(self.siteInfo, self.groupInfo, self.adminInfo, userInfo) auditor.info(INVITE_OLD_USER) inviter.send_notification(data['subject'], data['message'], inviteId, data['fromAddr']) s = '{0}\n<li><a href="{1}">{2}</a></li>\n' self.status = s.format(self.status, userInfo.url, userInfo.name) self.set_delivery(userInfo, data['delivery']) self.status = '<p>Invited the following users to '\ 'join <a class="fn" href="%s">%s</a></p><ul>%s</ul>' %\ (self.groupInfo.relativeURL, self.groupInfo.name, self.status) if not (data['site_members']): self.status = '<p>No site members were selected.</p>' assert self.status
def groupsInfo(self): ctx = get_the_actual_instance_from_zope(self.context) retval = createObject('groupserver.GroupsInfo', ctx) assert retval return retval
def ctx(self): return get_the_actual_instance_from_zope(self.context)
def groupsInfo(self): ctx = get_the_actual_instance_from_zope(self.context) retval = createObject('groupserver.GroupsInfo', ctx) assert retval return retval
def ctx(self): return get_the_actual_instance_from_zope(self.context)
def groupInfo(self): if self.__groupInfo == None: self.__groupInfo = createObject('groupserver.GroupInfo', get_the_actual_instance_from_zope(self.context)) assert self.__groupInfo return self.__groupInfo
def get_auditor_inviter(self): ctx = get_the_actual_instance_from_zope(self.context) inviter = Inviter(ctx, self.request, self.userInfo, self.adminInfo, self.siteInfo, self.groupInfo) auditor = Auditor(self.siteInfo, self.groupInfo, self.adminInfo, self.userInfo) return (auditor, inviter)