commit | author | age
|
1ad1db
|
1 |
from webob import Response |
feceff
|
2 |
from pyramid.security import NO_PERMISSION_REQUIRED |
197f0c
|
3 |
from pyramid.view import view_config |
1ad1db
|
4 |
|
197f0c
|
5 |
@view_config(name='x') |
36cdc6
|
6 |
def x_view(request): # pragma: no cover |
1ad1db
|
7 |
return Response('this is private!') |
CM |
8 |
|
197f0c
|
9 |
@view_config(name='y', permission='private2') |
36cdc6
|
10 |
def y_view(request): # pragma: no cover |
1ad1db
|
11 |
return Response('this is private too!') |
CM |
12 |
|
feceff
|
13 |
@view_config(name='z', permission=NO_PERMISSION_REQUIRED) |
1ad1db
|
14 |
def z_view(request): |
CM |
15 |
return Response('this is public') |
c1eb0c
|
16 |
|
CM |
17 |
def includeme(config): |
|
18 |
from pyramid.authorization import ACLAuthorizationPolicy |
|
19 |
from pyramid.authentication import AuthTktAuthenticationPolicy |
4bc4b4
|
20 |
authn_policy = AuthTktAuthenticationPolicy('seekt1t', hashalg='sha512') |
c1eb0c
|
21 |
authz_policy = ACLAuthorizationPolicy() |
24b1c8
|
22 |
config.scan('pyramid.tests.pkgs.defpermbugapp') |
c1eb0c
|
23 |
config._set_authentication_policy(authn_policy) |
CM |
24 |
config._set_authorization_policy(authz_policy) |
|
25 |
config.set_default_permission('private') |
|
26 |
|