commit | author | age
|
0b2629
|
1 |
class RootFactory(object): |
CM |
2 |
__acl__ = [('Allow', 'fred', 'view')] |
|
3 |
def __init__(self, request): |
|
4 |
pass |
|
5 |
|
|
6 |
class LocalRootFactory(object): |
|
7 |
__acl__ = [('Allow', 'bob', 'view')] |
|
8 |
def __init__(self, request): |
|
9 |
pass |
|
10 |
|
|
11 |
|
|
12 |
def includeme(config): |
|
13 |
from pyramid.authentication import RemoteUserAuthenticationPolicy |
|
14 |
from pyramid.authorization import ACLAuthorizationPolicy |
|
15 |
authn_policy = RemoteUserAuthenticationPolicy() |
|
16 |
authz_policy = ACLAuthorizationPolicy() |
|
17 |
config._set_authentication_policy(authn_policy) |
|
18 |
config._set_authorization_policy(authz_policy) |
|
19 |
config.add_static_view('allowed', 'pyramid.tests:fixtures/static/') |
|
20 |
config.add_static_view('protected', 'pyramid.tests:fixtures/static/', |
|
21 |
permission='view') |
|
22 |
config.add_static_view('factory_protected', |
|
23 |
'pyramid.tests:fixtures/static/', |
|
24 |
permission='view', |
|
25 |
factory=LocalRootFactory) |