diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-16 10:32:08 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-16 10:32:08 +0000 |
| commit | 2466f6eaa2246598dc6cb3c962364773eb4cc64a (patch) | |
| tree | 80954892ad8e12cffb534f3ae92cd321d4d870f5 /repoze/bfg/sampleapp/models.py | |
| parent | 23aa82c4963dc75737d7dc8a84d7639775c3b282 (diff) | |
| download | pyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.tar.gz pyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.tar.bz2 pyramid-2466f6eaa2246598dc6cb3c962364773eb4cc64a.zip | |
Add security.
Diffstat (limited to 'repoze/bfg/sampleapp/models.py')
| -rw-r--r-- | repoze/bfg/sampleapp/models.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/repoze/bfg/sampleapp/models.py b/repoze/bfg/sampleapp/models.py index 975d79142..d07110e83 100644 --- a/repoze/bfg/sampleapp/models.py +++ b/repoze/bfg/sampleapp/models.py @@ -1,5 +1,10 @@ from zope.interface import Interface from zope.interface import implements +from zope.location.interfaces import ILocation +from zope.location.location import Location + +from repoze.bfg.security import Everyone +from repoze.bfg.security import Allow import datetime @@ -9,20 +14,26 @@ class IMapping(Interface): class IBlog(Interface): pass -class Blog(dict): - implements(IBlog, IMapping) - def __init__(self, name): - self.__name__ = name - dict.__init__(self) +class Blog(dict, Location): + __acl__ = [ (Allow, Everyone, 'view'), (Allow, 'group:editors', 'add'), + (Allow, 'group:managers', 'manage') ] + implements(IBlog, IMapping, ILocation) class IBlogEntry(Interface): pass class BlogEntry(object): implements(IBlogEntry) - def __init__(self, name, title, body, author): - self.__name__ = name + def __init__(self, title, body, author): self.title = title self.body = body self.author = author self.created = datetime.datetime.now() + +blog = Blog() +blog['sample'] = BlogEntry('Sample Blog Entry', + '<p>This is a sample blog entry</p>', + 'chrism') +def get_root(environ): + return blog + |
