Exemple #1
0
 def accept(self, userInfo):
     self.requestQuery.accept_request(userInfo.id, self.groupInfo.id, self.adminInfo.id)
     if user_member_of_group(userInfo, self.groupInfo):
         retval = '%s is already a member of the group, so '\
             'the request was ignored.' % userInfo_to_anchor(userInfo)
     else:
         joiningUser = IGSJoiningUser(userInfo)
         joiningUser.silent_join(self.groupInfo)
         retval = 'Accepted the request from %s' % userInfo_to_anchor(userInfo)
     return retval
 def xhtml(self):
     cssClass = 'audit-event profile-invite-event-%s' % self.code
     retval = '<span class="%s">Withdrew the invitation to '\
         'join %s from %s.</span>' %\
         (cssClass, groupInfo_to_anchor(self.groupInfo),
          userInfo_to_anchor(self.instanceUserInfo))
     if ((self.instanceUserInfo.id != self.userInfo.id)
             and not (self.userInfo.anonymous)):
         retval = '%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     return retval
 def xhtml(self):
     cssClass = 'audit-event profile-invite-event-%s' % self.code
     retval = '<span class="%s">Withdrew the invitation to '\
         'join %s from %s.</span>' %\
         (cssClass, groupInfo_to_anchor(self.groupInfo),
          userInfo_to_anchor(self.instanceUserInfo))
     if ((self.instanceUserInfo.id != self.userInfo.id)
         and not(self.userInfo.anonymous)):
         retval = '%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     return retval
Exemple #4
0
 def xhtml(self):
     cssClass = 'audit-event profile-add-event-%s' % self.code
     retval = '<span class="%s">Tried to add the existing member '\
         ' %s to join %s.</span>' %\
         (cssClass, userInfo_to_anchor(self.instanceUserInfo),
         groupInfo_to_anchor(self.groupInfo))
     if ((self.instanceUserInfo.id != self.userInfo.id)
         and not(self.userInfo.anonymous)):
         retval = '%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     return retval
 def xhtml(self):
     cssClass = u'audit-event groupserver-profile-invite-%s' %\
       self.code
     retval = u'<span class="%s">%s %s the invitation from %s to '\
                 u'join %s</span>' % \
                 (cssClass, userInfo_to_anchor(self.instanceUserInfo),
                     self.instanceDatum.title(),
                     userInfo_to_anchor(self.userInfo),
                     groupInfo_to_anchor(self.groupInfo))
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
Exemple #6
0
 def xhtml(self):
     cssClass = u'audit-event groupserver-profile-invite-%s' %\
       self.code
     retval = u'<span class="%s">%s %s the invitation from %s to '\
                 u'join %s</span>' % \
                 (cssClass, userInfo_to_anchor(self.instanceUserInfo),
                     self.instanceDatum.title(),
                     userInfo_to_anchor(self.userInfo),
                     groupInfo_to_anchor(self.groupInfo))
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
Exemple #7
0
 def xhtml(self):
     cssClass = 'audit-event profile-add-event-{}'.format(self.code)
     m = '<span class="{cssClass}">Adding the existing user {user} '\
         'to {group}</span>'
     retval = m.format(cssClass=cssClass,
                         user=userInfo_to_anchor(self.instanceUserInfo),
                         group=groupInfo_to_anchor(self.groupInfo))
     if ((self.instanceUserInfo.id != self.userInfo.id)
         and not(self.userInfo.anonymous)):
         retval = '{} &#8212; {}'.format(retval,
                                         userInfo_to_anchor(self.userInfo))
     return retval
 def xhtml(self):
     d = munge_date(self.groupInfo.groupObj, self.date)
     ui = userInfo_to_anchor(self.userInfo)
     if not(self.removingUserInfo.anonymous) and self.removingUserInfo.id != self.userInfo.id:
         retval = _('event-leave-other', '${userName} removed by ${adminName} (${date})',
                    mapping={'userName': ui,
                             'adminName': userInfo_to_anchor(self.removingUserInfo),
                             'date': d, })
     else:
         retval = _('event-leave-normal', '${userName} left (${date})',
                    mapping={'userName': ui, 'date': d, })
     return retval
 def rejoin_advice(self):
     if self.__rejoin_advice == None:
         if self.joinability == ANYONE:
             self.__rejoin_advice = u'you can rejoin at any time'
         elif self.joinability == REQUEST:
             admins = self.groupInfo.group_admins
             self.__rejoin_advice = u'to rejoin, you can apply to '\
               u'%s at any time' % comma_comma_and([userInfo_to_anchor(a) for a in admins], conj='or')
         elif self.joinability == INVITE:
             admins = self.groupInfo.group_admins
             self.__rejoin_advice = u'to rejoin, you must be '\
               u'invited by %s' % comma_comma_and([userInfo_to_anchor(a) for a in admins], conj='or')
     return self.__rejoin_advice
Exemple #10
0
 def xhtml(self):
     cssClass = 'audit-event profile-add-event-{0}'.format(self.code)
     email = '<code class="email">{}</code>'.format(self.instanceDatum)
     m = '<span class="{cssClass}">Adding the new user {user} (with '\
         'the email address {email}) to join {group}.</span>'
     retval = m.format(cssClass=cssClass, email=email,
                       user=userInfo_to_anchor(self.instanceUserInfo),
                       group=groupInfo_to_anchor(self.groupInfo))
     if ((self.instanceUserInfo.id != self.userInfo.id)
             and not(self.userInfo.anonymous)):
         u = userInfo_to_anchor(self.userInfo)
         retval = '{0} &#8212; {1}'.format(retval, u)
     return retval
Exemple #11
0
 def rejoin_advice(self):
     if self.__rejoin_advice == None:
         if self.joinability == ANYONE:
             self.__rejoin_advice = u'you can rejoin at any time'
         elif self.joinability == REQUEST:
             admins = self.groupInfo.group_admins
             self.__rejoin_advice = u'to rejoin, you can apply to '\
               u'%s at any time' % comma_comma_and([userInfo_to_anchor(a) for a in admins], conj='or')
         elif self.joinability == INVITE:
             admins = self.groupInfo.group_admins
             self.__rejoin_advice = u'to rejoin, you must be '\
               u'invited by %s' % comma_comma_and([userInfo_to_anchor(a) for a in admins], conj='or')
     return self.__rejoin_advice
 def xhtml(self):
     cssClass = CSS_CLASS.format(self.code)
     email = EMAIL.format(self.instanceDatum)
     ua = userInfo_to_anchor(self.instanceUserInfo)
     ga = groupInfo_to_anchor(self.groupInfo)
     r = '<span class="{0}">Tried to invite the existing member '\
         ' {1} (with email {2}) to join {3}.</span>'
     retval = r.format(cssClass, ua, email, ga)
     if ((self.instanceUserInfo.id != self.userInfo.id)
             and not (self.userInfo.anonymous)):
         retval = '%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     return retval
 def xhtml(self):
     cssClass = CSS_CLASS.format(self.code)
     email = EMAIL.format(self.instanceDatum)
     ua = userInfo_to_anchor(self.instanceUserInfo)
     ga = groupInfo_to_anchor(self.groupInfo)
     r = '<span class="{0}">Tried to invite the existing member '\
         ' {1} (with email {2}) to join {3}.</span>'
     retval = r.format(cssClass, ua, email, ga)
     if ((self.instanceUserInfo.id != self.userInfo.id)
         and not(self.userInfo.anonymous)):
         retval = '%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     return retval
 def xhtml(self):
     d = munge_date(self.groupInfo.groupObj, self.date)
     ui = userInfo_to_anchor(self.userInfo)
     if not(self.addingUserInfo.anonymous) and (self.addingUserInfo.id != self.userInfo.id):
         retval = _('event-join-admin',
                    '${userName} joined &#8212; invited by ${adminName} (${date})',
                    mapping={'userName': ui,
                             'adminName': userInfo_to_anchor(self.addingUserInfo),
                             'date': d, })
     else:
         retval = _('event-join-normal', '${userName} joined (${date})',
                    mapping={'userName': ui, 'date': d, })
     return retval
Exemple #15
0
    def add_existing_user(self, toAddr):
        acl_users = self.context.acl_users
        user = acl_users.get_userByEmail(toAddr)
        if not user:
            m = 'User for address <{0}> not found'.format(toAddr)
            raise LookupError(m)
        # get the user object in the context of the group and site
        userInfo = createObject('groupserver.UserFromId', self.context,
                                user.getId())
        auditor = self.get_auditor(userInfo)
        e = '<code class="email">{0}</code>'.format(toAddr)
        if user_member_of_group(user, self.groupInfo):
            status = ADD_EXISTING_MEMBER
            auditor.info(status, toAddr)
            m = _('existing-member-msg',
                  '<li>The person with the email address ${email} '
                  '&#8213; ${user} &#8213; is already a member of '
                  '${group}. No changes to the profile of ${user} have '
                  'been made.</li>',
                  mapping={
                      'email': e,
                      'user': userInfo_to_anchor(userInfo),
                      'group': groupInfo_to_anchor(self.groupInfo)
                  })
        else:
            status = ADD_OLD_USER
            auditor.info(status, toAddr)
            joininguser = IGSJoiningUser(userInfo)
            joininguser.silent_join(self.groupInfo)

            # Verify the address <https://redmine.iopen.net/issues/4037>
            eu = EmailUser(self.context, userInfo)
            if not eu.is_address_verified(toAddr):
                evu = EmailVerificationUser(self.context, userInfo, toAddr)
                verificationId = evu.create_verification_id()
                evu.add_verification_id(verificationId)
                evu.verify_email(verificationId)

            m = _('existing-profile-msg',
                  '<li>Adding the existing participant with  the email '
                  'address ${email} &#8213; ${user} &#8213; to '
                  '${group}.</li>',
                  mapping={
                      'email': e,
                      'user': userInfo_to_anchor(userInfo),
                      'group': groupInfo_to_anchor(self.groupInfo)
                  })
        msg = translate(m)
        retval = (msg, userInfo, status)
        return retval
Exemple #16
0
    def add_new_user(self, toAddr, profileDict):
        # Email address does not exist, but it is a legitimate address
        user = create_user_from_email(self.context, toAddr)
        # force verify
        vid = '%s-%s-verified' % (toAddr, self.adminInfo.id)
        evu = createObject('groupserver.EmailVerificationUserFromEmail',
                           self.context, toAddr)
        evu.add_verification_id(vid)
        evu.verify_email(vid)

        # get the user object in the context of the group and site
        userInfo = createObject('groupserver.UserFromId', self.context,
                                user.id)
        self.add_profile_attributes(userInfo, profileDict)
        auditor = self.get_auditor(userInfo)
        status = ADD_NEW_USER
        auditor.info(status, toAddr)
        joininguser = IGSJoiningUser(userInfo)
        joininguser.silent_join(self.groupInfo)
        e = '<code class="email">{0}</code>'.format(toAddr)
        msg = _('new-profile-member',
                '<li>A profile for ${user} has been created, and given the '
                'email address ${email}.</li>\n'
                '<li>${user} has been joined to ${group}.</li>\n',
                mapping={
                    'email': e,
                    'user': userInfo_to_anchor(userInfo),
                    'group': groupInfo_to_anchor(self.groupInfo)
                })
        retval = (msg, userInfo, status)
        return retval
    def add_new_user(self, toAddr, profileDict):
        # Email address does not exist, but it is a legitimate address
        user = create_user_from_email(self.context, toAddr)
        # force verify
        vid = '%s-%s-verified' % (toAddr, self.adminInfo.id)
        evu = createObject('groupserver.EmailVerificationUserFromEmail',
                           self.context, toAddr)
        evu.add_verification_id(vid)
        evu.verify_email(vid)

        # get the user object in the context of the group and site
        userInfo = createObject('groupserver.UserFromId', self.context,
                                user.id)
        self.add_profile_attributes(userInfo, profileDict)
        auditor = self.get_auditor(userInfo)
        status = ADD_NEW_USER
        auditor.info(status, toAddr)
        joininguser = IGSJoiningUser(userInfo)
        joininguser.silent_join(self.groupInfo)
        e = '<code class="email">{0}</code>'.format(toAddr)
        msg = _('new-profile-member',
                '<li>A profile for ${user} has been created, and given the '
                'email address ${email}.</li>\n'
                '<li>${user} has been joined to ${group}.</li>\n',
                mapping={'email': e,
                         'user': userInfo_to_anchor(userInfo),
                         'group': groupInfo_to_anchor(self.groupInfo)})
        retval = (msg, userInfo, status)
        return retval
Exemple #18
0
 def xhtml(self):
     cssClass = 'audit-event site-event-%s' % self.code
     retval = '<span class="%s">Change introduction</span>' % cssClass
     retval = '%s &#8212; %s' % (retval,
                                 userInfo_to_anchor(self.userInfo))
     retval = '%s (%s)' % (retval, munge_date(self.context, self.date))
     return retval
    def actual_add(self, data):
        retval = {}

        adder = Adder(self.context, self.groupInfo, self.loggedInUser)
        toAddr = sanitise_address(data['toAddr'])
        linked_groupname = groupInfo_to_anchor(self.groupInfo)

        msg, userInfo, status = adder.add(toAddr, data)
        linked_username = userInfo_to_anchor(userInfo)

        # Tell the user
        if status == ADD_NEW_USER:
            notifier = NotifyAdd(self.context, self.request)
            fromAddr = sanitise_address(data['fromAddr'])
            passwd = self.get_password_reset(userInfo, toAddr)
            notifier.notify(self.loggedInUser, userInfo, fromAddr, toAddr,
                            passwd)

            retval['status'] = 1
            m = []
            m.append('A profile for {0} has been created, and given the '
                     'email address <code>{1}</code>.')
            m.append('{0} has been added to {2}.')
            m = [i.format(linked_username, toAddr, linked_groupname)
                 for i in m]
            retval['message'] = m

        elif status == ADD_OLD_USER:
            notifier = NotifyJoin(self.context, self.request)
            notifier.notify(userInfo)

            retval['status'] = 2
            m = []
            m.append('Added the existing person with the email address '
                     '<code>{0}</code> ({1}) to {2}.')
            m = [i.format(toAddr, linked_username, linked_groupname)
                 for i in m]
            retval['message'] = m
        elif status == ADD_EXISTING_MEMBER:
            retval['status'] = 3
            m = []
            m.append('The person with the email address <code>{0}</code> '
                     '({1}) is already a member of {2}.')
            m.append('No changes to the profile of {1} have been made.')
            m = [i.format(toAddr, linked_username, linked_groupname)
                 for i in m]
            retval['message'] = m
        else:
            retval['status'] = 100
            retval['message'] = 'An unknown event occurred.'

        # Tell the administrator
        if status in (ADD_NEW_USER, ADD_OLD_USER):
            adminNotifier = NotifyAdmin(self.context, self.request)
            for adminInfo in self.groupInfo.group_admins:
                adminNotifier.notify(adminInfo, userInfo)

        retval = to_json(retval, indent=4)
        return retval
    def add_existing_user(self, toAddr):
        acl_users = self.context.acl_users
        user = acl_users.get_userByEmail(toAddr)
        if not user:
            m = 'User for address <{0}> not found'.format(toAddr)
            raise LookupError(m)
        # get the user object in the context of the group and site
        userInfo = createObject('groupserver.UserFromId', self.context,
                                user.getId())
        auditor = self.get_auditor(userInfo)
        e = '<code class="email">{0}</code>'.format(toAddr)
        if user_member_of_group(user, self.groupInfo):
            status = ADD_EXISTING_MEMBER
            auditor.info(status, toAddr)
            m = _('existing-member-msg',
                  '<li>The person with the email address ${email} '
                  '&#8213; ${user} &#8213; is already a member of '
                  '${group}. No changes to the profile of ${user} have '
                  'been made.</li>',
                  mapping={'email': e,
                           'user': userInfo_to_anchor(userInfo),
                           'group': groupInfo_to_anchor(self.groupInfo)})
        else:
            status = ADD_OLD_USER
            auditor.info(status, toAddr)
            joininguser = IGSJoiningUser(userInfo)
            joininguser.silent_join(self.groupInfo)

            # Verify the address <https://redmine.iopen.net/issues/4037>
            eu = EmailUser(self.context, userInfo)
            if not eu.is_address_verified(toAddr):
                evu = EmailVerificationUser(self.context, userInfo, toAddr)
                verificationId = evu.create_verification_id()
                evu.add_verification_id(verificationId)
                evu.verify_email(verificationId)

            m = _('existing-profile-msg',
                  '<li>Adding the existing participant with  the email '
                  'address ${email} &#8213; ${user} &#8213; to '
                  '${group}.</li>',
                  mapping={'email': e,
                           'user': userInfo_to_anchor(userInfo),
                           'group': groupInfo_to_anchor(self.groupInfo)})
        msg = translate(m)
        retval = (msg, userInfo, status)
        return retval
 def get_version_description(self, ver):
     vUI = createObject('groupserver.UserFromId', self.folder, ver.editor)
     dt = munge_date(self.folder, ver.creationDate, '%Y %b %d %H:%M:%S')
     if vUI.anonymous:
         retval = 'an %s (%s)' % (vUI.name.lower(), dt)
     else:
         retval = '%s (%s)' % (userInfo_to_anchor(vUI), dt)
     assert retval
     return retval
Exemple #22
0
 def xhtml(self):
     cssClass = u'audit-event profile-event-%s' % self.code
     retval = u'<span class="%s">Set password</span>' % cssClass
     if self.instanceUserInfo.id != self.userInfo.id:
         retval = u'%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
    def xhtml(self):
        cssClass = 'audit-event groupserver-group-member-%s' % self.code
        retval = '<span class="%s">Given the status of %s in %s</span>' % \
            (cssClass, self.instanceDatum, groupInfo_to_anchor(self.groupInfo))

        if self.instanceUserInfo.id != self.userInfo.id:
            retval = '%s &#8212; %s' % (retval, userInfo_to_anchor(self.userInfo))
        retval = '%s (%s)' % (retval, munge_date(self.context, self.date))
        return retval
Exemple #24
0
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-home-%s' %\
         self.code
     retval = '<span class="%s">%s changed the About tab on the'\
         'homepage of %s</span>' % \
         (cssClass, userInfo_to_anchor(self.instanceUserInfo),
          groupInfo_to_anchor(self.groupInfo))
     retval = '%s (%s)' % \
         (retval, munge_date(self.context, self.date))
     return retval
Exemple #25
0
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-home-%s' %\
         self.code
     retval = '<span class="%s">%s changed the About tab on the'\
         'homepage of %s</span>' % \
         (cssClass, userInfo_to_anchor(self.instanceUserInfo),
          groupInfo_to_anchor(self.groupInfo))
     retval = '%s (%s)' % \
         (retval, munge_date(self.context, self.date))
     return retval
 def get_version_description(self, ver):
     vUI = createObject('groupserver.UserFromId',
                         self.folder, ver.editor)
     dt = munge_date(self.folder,
       ver.creationDate, '%Y %b %d %H:%M:%S')
     if vUI.anonymous:
         retval = 'an %s (%s)' % (vUI.name.lower(), dt)
     else:
         retval = '%s (%s)' % (userInfo_to_anchor(vUI), dt)
     assert retval
     return retval
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-member-email-settings-%s'\
                % self.code
     r = '<span class="{0}">Switched to web-only mode in {1}'
     retval = r.format(cssClass, groupInfo_to_anchor(self.groupInfo))
     if self.adminChanged:
         uu = userInfo_to_anchor(self.userInfo)
         retval = '{0} by {1}'.format(retval, uu)
     d = munge_date(self.context, self.date)
     retval = '{0}</span> ({1})'.format(retval, d)
     return retval
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-member-email-settings-%s'\
                % self.code
     r = '<span class="{0}">Switched to web-only mode in {1}'
     retval = r.format(cssClass, groupInfo_to_anchor(self.groupInfo))
     if self.adminChanged:
         uu = userInfo_to_anchor(self.userInfo)
         retval = '{0} by {1}'.format(retval, uu)
     d = munge_date(self.context, self.date)
     retval = '{0}</span> ({1})'.format(retval, d)
     return retval
Exemple #29
0
 def xhtml(self):
     d = munge_date(self.groupInfo.groupObj, self.date)
     ui = userInfo_to_anchor(self.userInfo)
     if not (self.addingUserInfo.anonymous) and (self.addingUserInfo.id !=
                                                 self.userInfo.id):
         retval = _(
             'event-join-admin',
             '${userName} joined &#8212; invited by ${adminName} (${date})',
             mapping={
                 'userName': ui,
                 'adminName': userInfo_to_anchor(self.addingUserInfo),
                 'date': d,
             })
     else:
         retval = _('event-join-normal',
                    '${userName} joined (${date})',
                    mapping={
                        'userName': ui,
                        'date': d,
                    })
     return retval
Exemple #30
0
 def xhtml(self):
     cssClass = u'audit-event profile-event-%s' % self.code
     retval = u'<span class="%s">Created a user, with address '\
       u'<code class="email">%s</code></span>' %\
         (cssClass, self.instanceDatum)
     if ((self.instanceUserInfo.id != self.userInfo.id)
         and not(self.userInfo.anonymous)):
         retval = u'%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
Exemple #31
0
 def xhtml(self):
     d = munge_date(self.groupInfo.groupObj, self.date)
     ui = userInfo_to_anchor(self.userInfo)
     if not (self.removingUserInfo.anonymous
             ) and self.removingUserInfo.id != self.userInfo.id:
         retval = _('event-leave-other',
                    '${userName} removed by ${adminName} (${date})',
                    mapping={
                        'userName': ui,
                        'adminName':
                        userInfo_to_anchor(self.removingUserInfo),
                        'date': d,
                    })
     else:
         retval = _('event-leave-normal',
                    '${userName} left (${date})',
                    mapping={
                        'userName': ui,
                        'date': d,
                    })
     return retval
Exemple #32
0
 def xhtml(self):
     cssClass = 'audit-event gs-group-type-set-{0}'.format(self.code)
     m = '<span class="{cssClass}">Changed the type of {group} '\
         'to {toType} from {fromType}.</span>'
     retval = m.format(cssClass=cssClass,
                       group=groupInfo_to_anchor(self.groupInfo),
                       toType=self.instanceDatum,
                       fromType=self.supplementaryDatum)
     if ((self.instanceUserInfo.id != self.userInfo.id)
             and not (self.userInfo.anonymous)):
         u = userInfo_to_anchor(self.userInfo)
         retval = '{0} &#8212; {1}'.format(retval, u)
     return retval
 def xhtml(self):
     cssClass = 'audit-event gs-profile-email-verify-%s' % self.code
     if self.adminAdded:
         retval = '<span class="%s">%s added a verification request '\
                  'for <code class="email">%s</code>.</span>' % \
                  (cssClass, userInfo_to_anchor(self.userInfo),
                   self.instanceDatum)
     else:
         retval = '<span class="%s">Added a verification request '\
                  'for <code class="email">%s</code>.</span>' % \
                  (cssClass, self.instanceDatum)
     retval = '%s (%s)' % (retval, munge_date(self.context, self.date))
     return retval
 def xhtml(self):
     cssClass = u'audit-event gs-profile-email-%s' %\
       self.code
     if self.adminRemoved:
         retval = u'<span class="%s">%s removed the address '\
           u'<code class="email">%s</code>.</span>' % \
           (cssClass, userInfo_to_anchor(self.userInfo), 
            self.instanceDatum)
     else:
         retval = u'<span class="%s">Removed the address '\
           u'<code class="email">%s</code>.</span>' % \
           (cssClass, self.instanceDatum)
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
Exemple #35
0
 def xhtml(self):
     cssClass = u'audit-event gs-profile-email-%s' %\
       self.code
     if self.adminRemoved:
         retval = u'<span class="%s">%s removed the address '\
           u'<code class="email">%s</code>.</span>' % \
           (cssClass, userInfo_to_anchor(self.userInfo),
            self.instanceDatum)
     else:
         retval = u'<span class="%s">Removed the address '\
           u'<code class="email">%s</code>.</span>' % \
           (cssClass, self.instanceDatum)
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
Exemple #36
0
    def xhtml(self):
        cssClass = 'audit-event groupserver-group-member-%s' % self.code
        retval = ''
        # --=mpj17=-- Sometimes this is false. I do not know why.
        if self.groupInfo.id:
            retval = '<span class="%s">Left %s</span>' % \
                (cssClass, groupInfo_to_anchor(self.groupInfo))

            if self.adminRemoved:
                retval = '%s &#8212; removed by %s' % \
                    (retval, userInfo_to_anchor(self.userInfo))
                retval = '%s (%s)' % \
                    (retval, munge_date(self.context, self.date))
        return retval
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-member-email-settings-%s'\
                % self.code
     addrs = ['<code class="email">{0}</code>'.format(a) for a in
              self.instanceDatum.split()]
     addrStr = comma_comma_and(addrs)
     r = '<span class="{0}">Switched to use the email addresses {1} in '\
         '{2}'
     retval = r.format(cssClass, addrStr,
                       groupInfo_to_anchor(self.groupInfo))
     if self.adminChanged:
         uu = userInfo_to_anchor(self.userInfo)
         retval = '{0} by {1}'.format(retval, uu)
     d = munge_date(self.context, self.date)
     retval = '{0}</span> ({1})'.format(retval, d)
     return retval
Exemple #38
0
 def xhtml(self):
     cssClass = u'audit-event profile-event-%s' % self.code
     old, new = self.get_old_new()
     retval = u'<span class="%s">Profile-field '\
       u'<span class="field-%s">%s</span> '\
       u'changed to '\
       u'<code class="new">%s</code> (was '\
       u'<code class="old">%s</code>)</span>' % \
       (cssClass, self.instanceDatum, self.get_fieldname(),
         xml_escape(new), xml_escape(old))
     if self.instanceUserInfo.id != self.userInfo.id:
         retval = u'%s &#8212; %s' %\
           (retval, userInfo_to_anchor(self.userInfo))
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
 def xhtml(self):
     cssClass = u'audit-event gs-profile-email-%s' %\
       self.code
     if self.adminSet:
         retval = u'<span class="%s">%s set the address '\
           u'<code class="email">%s</code> for default '\
           u'delivery.</span>' % \
           (cssClass, userInfo_to_anchor(self.userInfo), 
            self.instanceDatum)
     else:
         retval = u'<span class="%s">Set the address '\
           u'<code class="email">%s</code> for default '\
           u'delivery.</span>' % \
           (cssClass, self.instanceDatum)
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
Exemple #40
0
 def xhtml(self):
     cssClass = u'audit-event gs-profile-email-%s' %\
       self.code
     if self.adminSet:
         retval = u'<span class="%s">%s set the address '\
           u'<code class="email">%s</code> for default '\
           u'delivery.</span>' % \
           (cssClass, userInfo_to_anchor(self.userInfo),
            self.instanceDatum)
     else:
         retval = u'<span class="%s">Set the address '\
           u'<code class="email">%s</code> for default '\
           u'delivery.</span>' % \
           (cssClass, self.instanceDatum)
     retval = u'%s (%s)' % \
       (retval, munge_date(self.context, self.date))
     return retval
Exemple #41
0
    def invite_user_success(self, action, data):
        # Zope's regular form validation system *should* take care of checking
        # on columns and what not. So here we just have to pass data on to the
        # actual invite code and package the result up as json
        inviteProcessor = InviteProcessor(self.context, self.request,
                                          self.siteInfo, self.groupInfo,
                                          self.loggedInUser, self.form_fields,
                                          self.inviteFields)
        result, userInfo = inviteProcessor.process(data)

        # Prep data for display
        addr = sanitise_address(data['toAddr'])
        linked_username = userInfo_to_anchor(userInfo)
        linked_groupname = groupInfo_to_anchor(self.groupInfo)
        retval = {}

        if result == INVITE_NEW_USER:
            retval['status'] = 1
            m = []
            m.append('A profile for {0} has been created, and given the '
                     'email address <code>{1}</code>.')
            m.append('{0} has been sent an invitation to join {2}.')
            m = [i.format(linked_username, addr, linked_groupname) for i in m]
            retval['message'] = m
        elif result == INVITE_OLD_USER:
            retval['status'] = 2
            m = []
            m.append('Inviting the existing person with the email address '
                     '<code>{0}</code> ― {1} ― to join {2}.')
            m = [i.format(addr, linked_username, linked_groupname) for i in m]
            retval['message'] = m
        elif result == INVITE_EXISTING_MEMBER:
            retval['status'] = 3
            m = []
            m.append('The person with the email address <code>{0}</code> ― '
                     '{1} ― is already a member of {2}.')
            m.append('No changes to the profile of {1} have been made.')
            m = [i.format(addr, linked_username, linked_groupname) for i in m]
            retval['message'] = m
        else:
            retval['status'] = 100
            retval['message'] = 'An unknown event occurred.'

        retval = json.dumps(retval, indent=4)
        return retval
 def xhtml(self):
     cssClass = 'audit-event groupserver-group-member-email-settings-%s'\
                % self.code
     addrs = [
         '<code class="email">{0}</code>'.format(a)
         for a in self.instanceDatum.split()
     ]
     addrStr = comma_comma_and(addrs)
     r = '<span class="{0}">Switched to use the email addresses {1} in '\
         '{2}'
     retval = r.format(cssClass, addrStr,
                       groupInfo_to_anchor(self.groupInfo))
     if self.adminChanged:
         uu = userInfo_to_anchor(self.userInfo)
         retval = '{0} by {1}'.format(retval, uu)
     d = munge_date(self.context, self.date)
     retval = '{0}</span> ({1})'.format(retval, d)
     return retval
 def actual_handle_add(self, action, data):
     u = userInfo_to_anchor(self.userInfo)
     e = '<code class="email">%s</code>' % self.defaultToEmail
     g = groupInfo_to_anchor(self.groupInfo)
     auditor, inviter = self.get_auditor_inviter()
     fullMembers = FullMembers(self.groupInfo.groupObj)
     invitedMembers = InvitedMembers(self.groupInfo.groupObj)
     if self.userId in fullMembers:
         auditor.info(INVITE_EXISTING_MEMBER, self.defaultToEmail)
         self.status = self.already_a_member(u, e, g)
     elif self.userId in invitedMembers:
         self.status = self.resent(u, e, g)
         inviteId = inviter.create_invitation(data, False)
         auditor.info(INVITE_OLD_USER, self.defaultToEmail)
         inviter.send_notification(data['subject'], data['message'],
                                   inviteId, data['fromAddr'], data['toAddr'])
     else:
         self.status = self.issues(u, e, g)
     assert self.status
Exemple #44
0
 def actual_handle_add(self, action, data):
     u = userInfo_to_anchor(self.userInfo)
     e = '<code class="email">%s</code>' % self.defaultToEmail
     g = groupInfo_to_anchor(self.groupInfo)
     auditor, inviter = self.get_auditor_inviter()
     fullMembers = FullMembers(self.groupInfo.groupObj)
     invitedMembers = InvitedMembers(self.groupInfo.groupObj)
     if self.userId in fullMembers:
         auditor.info(INVITE_EXISTING_MEMBER, self.defaultToEmail)
         self.status = self.already_a_member(u, e, g)
     elif self.userId in invitedMembers:
         self.status = self.resent(u, e, g)
         inviteId = inviter.create_invitation(data, False)
         auditor.info(INVITE_OLD_USER, self.defaultToEmail)
         inviter.send_notification(data['subject'], data['message'],
                                   inviteId, data['fromAddr'],
                                   data['toAddr'])
     else:
         self.status = self.issues(u, e, g)
     assert self.status
    def handle_invite(self, action, data):
        inviteProcessor = InviteProcessor(self.context, self.request,
                                          self.siteInfo, self.groupInfo,
                                          self.loggedInUser, self.form_fields,
                                          self.inviteFields)
        result, userInfo = inviteProcessor.process(data)

        # Prep data for display
        addrName, addr = parseaddr(data['toAddr'].strip())
        e = '<code class="email">%s</code>' % addr
        g = groupInfo_to_anchor(self.groupInfo)
        u = userInfo_to_anchor(userInfo)

        if result == INVITE_NEW_USER:
            m = '<li>A profile for {0} has been created, and given the '\
                'email address {1}.</li>\n'\
                '<li>{0} has been sent an invitation to join {2}.</li>'
            self.status = m.format(u, e, g)

        elif result == INVITE_OLD_USER:
            m = '<li>Inviting the existing person with the email address '\
                '{0} &#8213; {1} &#8213; to join {2}.</li>'
            self.status = m.format(e, u, g)

        elif result == INVITE_EXISTING_MEMBER:
            m = '<li>The person with the email address {0} &#8213; {1} '\
                '&#8213; is already a member of {2}.</li>\n'\
                '<li>No changes to the profile of {1} have been made.</li>'
            self.status = m.format(e, u, g)

        else:
            # What happened?
            m = '<li>An unknown event occurred while attempting to invite '\
                'the person with the email address {0} &#8213; {1} '\
                '&#8213; is already a member of {2}.</li>\n'\
                '<li>No changes to the profile of {1} have been made.</li>'
            self.status = m.format(e, u, g)

        self.status = '<ul>\n{0}\n</ul>'.format(self.status)
        assert userInfo, 'User not created or found'
        assert self.status
Exemple #46
0
 def decline(self, userInfo):
     self.requestQuery.decline_request(userInfo.id, self.groupInfo.id, self.adminInfo.id)
     return 'Declined the request from %s' % userInfo_to_anchor(userInfo)
Exemple #47
0
 def xhtml(self):
     cssClass = 'audit-event site-event-%s' % self.code
     retval = '<span class="%s">Change introduction</span>' % cssClass
     retval = '%s &#8212; %s' % (retval, userInfo_to_anchor(self.userInfo))
     retval = '%s (%s)' % (retval, munge_date(self.context, self.date))
     return retval