Changeset 2265
- Timestamp:
- 05/27/07 01:41:10 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modauthacctmgrscript/0.9/mod_auth_acctmgr/handler.py
r2263 r2265 13 13 options = req.get_options() 14 14 if 'TracEnv' not in options: 15 print 'Must specify a Trac environment'15 req.log_error('mod_auth_acctmgr: Must specify a Trac environment') 16 16 return None 17 17 env_path = options['TracEnv'] … … 23 23 pw = req.get_basic_auth_pw() 24 24 user = req.user 25 25 26 26 env = _get_env(req) 27 27 if env is None: … … 33 33 acct_mgr = AccountManager 34 34 35 options = req.get_options() 36 #if 'TracPerm' not in options: 37 # req.log_error('mod_auth_acctmgr: You must specify a permission') 38 # return apache.HTTP_FORBIDDEN 39 perm = options.get('TracPerm') 40 35 41 if acct_mgr(env).check_password(user, pw): 42 if perm: 43 user_perms = PermissionSystem(env).get_user_permissions(user) 44 if not user_perms.get(perm): 45 return apache.HTTP_FORBIDDEN 36 46 return apache.OK 37 47 else: 38 48 return apache.HTTP_UNAUTHORIZED 39 49 40 def authzhandler(req):50 def perms(req): 41 51 user = req.user 42 52 43 53 env = _get_env(req) 44 54 if env is None: 45 return apache. DECLINED55 return apache.HTTP_FORBIDDEN 46 56 47 57 options = req.get_options() 48 58 if 'TracPerm' not in options: 49 print 'You must specify a permission'50 return apache. DECLINED59 req.log_error('mod_auth_acctmgr: You must specify a permission') 60 return apache.HTTP_FORBIDDEN 51 61 perm = options['TracPerm'] 52 62 … … 55 65 return apache.OK 56 66 else: 57 return apache. DECLINED67 return apache.HTTP_FORBIDDEN 58 68 modauthacctmgrscript/0.9/mod_auth_acctmgr/__init__.py
r2263 r2265 1 from handler import * 1 # This allows "PythonAuthnHandler mod_auth_acctmgr" instead of "PythonAuthnHandler mod_auth_acctmgr.handler" 2 try: 3 from handler import * 4 except ImportError: 5 pass
