Пример #1
0
    def start(self, name, params):
        if not params:
            self.last_error = "no username provided for [%s]"%name
            return ''
        
        if ';' in params:
            (username, linktype) = params.split(';')
        else:
            username = params
            linktype = 'name'
            
        if name == 'icon':
            linktype = 'icon'
        
        user_object = ferrox.model.User.get_by_name(username)
        
        if user_object:
            if linktype == 'name':
                return h.link_to(user_object.display_name, h.url_for(controller='user', action='view', username=user_object.username))
            elif linktype == 'icon':
                return h.link_to("(Icon for %s goes here)"%user_object.display_name, h.url_for(controller='user', action='view', username=user_object.username))
            elif linktype == 'both':
                return h.link_to("(Icon for %s goes here)%s"%(user_object.display_name,user_object.display_name), h.url_for(controller='user', action='view', username=user_object.username))

        self.last_error = "invalid username provided for [%s]"%name
        return ''
Пример #2
0
 def check(func, *args, **kwargs):
     session_timeout = int(config.get('admin.session_timeout', 15*60))
     if int(session.get('admin_last_used', 0)) > int(time() - session_timeout):
         session['admin_last_used'] = int(time())
         session.save()
         return func(*args, **kwargs)
     h.redirect_to(h.url_for(controller='admin', action='auth'))
     return None
Пример #3
0
 def check(func, *args, **kwargs):
     session_timeout = int(config.get('admin.session_timeout', 15 * 60))
     if int(session.get('admin_last_used',
                        0)) > int(time() - session_timeout):
         session['admin_last_used'] = int(time())
         session.save()
         return func(*args, **kwargs)
     h.redirect_to(h.url_for(controller='admin', action='auth'))
     return None
Пример #4
0
    def start(self, name, params):
        if not params:
            self.last_error = "no username provided for [%s]" % name
            return ''

        if ';' in params:
            (username, linktype) = params.split(';')
        else:
            username = params
            linktype = 'name'

        if name == 'icon':
            linktype = 'icon'

        user_object = ferrox.model.User.get_by_name(username)

        if user_object:
            if linktype == 'name':
                return h.link_to(
                    user_object.display_name,
                    h.url_for(controller='user',
                              action='view',
                              username=user_object.username))
            elif linktype == 'icon':
                return h.link_to(
                    "(Icon for %s goes here)" % user_object.display_name,
                    h.url_for(controller='user',
                              action='view',
                              username=user_object.username))
            elif linktype == 'both':
                return h.link_to(
                    "(Icon for %s goes here)%s" %
                    (user_object.display_name, user_object.display_name),
                    h.url_for(controller='user',
                              action='view',
                              username=user_object.username))

        self.last_error = "invalid username provided for [%s]" % name
        return ''