Esempio n. 1
0
 def make_renderer_globals(system):
     'Define template constants'
     userID = authenticated_userid(system['request'])
     properties = users.get_properties(userID) or (u'', MINUTES_OFFSET, False, False, '')
     nickname, minutes_offset, is_active, is_super = properties[:-1]
     return dict(
         SITE_NAME=SITE_NAME, 
         SITE_VERSION=SITE_VERSION, 
         USER_ID=userID, 
         USER_NICKNAME=nickname, 
         USER_OFFSET=minutes_offset, 
         IS_SUPER=is_super, 
         IS_ACTIVE=is_active)
Esempio n. 2
0
 def make_renderer_globals(system):
     'Define template constants'
     userID = authenticated_userid(system['request'])
     properties = users.get_properties(userID) or (u'', MINUTES_OFFSET,
                                                   False, False, '')
     nickname, minutes_offset, is_active, is_super = properties[:-1]
     return dict(SITE_NAME=SITE_NAME,
                 SITE_VERSION=SITE_VERSION,
                 USER_ID=userID,
                 USER_NICKNAME=nickname,
                 USER_OFFSET=minutes_offset,
                 IS_SUPER=is_super,
                 IS_ACTIVE=is_active)
Esempio n. 3
0
 def get_groups(userID, request):
     'Return access categories associated with the user'
     # Get properties
     properties = users.get_properties(userID)
     if not properties:
         return []
     is_active, is_super, code = properties[-3:]
     # Check code
     identity = authenticationPolicy.cookie.identify(request)
     if code != users.parse_tokens(identity['tokens'])[0]:
         return ['d']
     # Set groups
     groups = []
     if is_active:
         groups.append('a')
     if is_super:
         groups.append('s')
     return groups
Esempio n. 4
0
 def get_groups(userID, request):
     'Return access categories associated with the user'
     # Get properties
     properties = users.get_properties(userID)
     if not properties:
         return []
     is_active, is_super, code = properties[-3:]
     # Check code
     identity = authenticationPolicy.cookie.identify(request)
     if code != users.parse_tokens(identity['tokens'])[0]:
         return ['d']
     # Set groups
     groups = []
     if is_active:
         groups.append('a')
     if is_super:
         groups.append('s')
     return groups