Changes between Version 82 and Version 83 of BluePrintAuthorization


Ignore:
Timestamp:
06/22/10 14:57:20 (14 years ago)
Author:
Fran Boon
Comment:

shn_has_role()

Legend:

Unmodified
Added
Removed
Modified
  • BluePrintAuthorization

    v82 v83  
    3131 * It is not currently proposed.
    3232
     33=== Functions added to AuthS3 class ===
     34All authentication functions should be stored in the AuthS3 class in {{{modules/sahana.py}}}.
     35
     36{{{shn_accessible_query()}}} & {{{shn_has_permission()}}} should be moved from {{{00_utils.py}}} to here.
     37
     38New function:
     39{{{
     40def shn_has_role(self, role):
     41    """
     42    Check whether the currently logged-in user has a role
     43    @param role can be integer or a name
     44    """
     45   
     46    if type(role) != int:
     47        role = deployment_settings.auth.roles[role]
     48
     49    if role in session.s3.roles:
     50        return True
     51    else:
     52        return False
     53}}}
    3354== Restrictions ==
    3455=== Module restriction ===