def authenhandler(req): pw = req.get_basic_auth_pw() user = req.user env = _get_env(req) if env is None: return apache.HTTP_FORBIDDEN global acct_mgr if acct_mgr is None: from acct_mgr.api import AccountManager acct_mgr = AccountManager options = req.get_options() #if 'TracPerm' not in options: # req.log_error('mod_auth_acctmgr: You must specify a permission') # return apache.HTTP_FORBIDDEN perm = options.get('TracPerm') if acct_mgr(env).check_password(user, pw): if perm: user_perms = PermissionSystem(env).get_user_permissions(user) if not user_perms.get(perm): return apache.HTTP_FORBIDDEN return apache.OK else: return apache.HTTP_UNAUTHORIZED
def authenhandler(req): pw = req.get_basic_auth_pw() user = req.user env = _get_env(req) if env is None: return apache.HTTP_FORBIDDEN global acct_mgr if acct_mgr is None: from acct_mgr.api import AccountManager acct_mgr = AccountManager options = req.get_options() #if 'TracPerm' not in options: # req.log_error('mod_auth_acctmgr: You must specify a permission') # return apache.HTTP_FORBIDDEN perm = options.get('TracPerm') if acct_mgr(env).check_password(user, pw): if perm: user_perms = PermissionSystem(env).get_user_permissions(user) if not user_perms.get(perm): return apache.HTTP_FORBIDDEN return apache.OK else: return apache.HTTP_UNAUTHORIZED
def perms(req): user = req.user env = _get_env(req) if env is None: return apache.HTTP_FORBIDDEN options = req.get_options() if 'TracPerm' not in options: req.log_error('mod_auth_acctmgr: You must specify a permission') return apache.HTTP_FORBIDDEN perm = options['TracPerm'] user_perms = PermissionSystem(self.env).get_user_permissions(user) if user_perms.get(perm): return apache.OK else: return apache.HTTP_FORBIDDEN
def perms(req): user = req.user env = _get_env(req) if env is None: return apache.HTTP_FORBIDDEN options = req.get_options() if 'TracPerm' not in options: req.log_error('mod_auth_acctmgr: You must specify a permission') return apache.HTTP_FORBIDDEN perm = options['TracPerm'] user_perms = PermissionSystem(self.env).get_user_permissions(user) if user_perms.get(perm): return apache.OK else: return apache.HTTP_FORBIDDEN