doc/tutorials/advanced/part02_security.rst
changeset 12879 7347715bf0ee
parent 12556 d1c659d70368
child 12881 38fcf5707295
equal deleted inserted replaced
12878:ec05a333f02c 12879:7347715bf0ee
   115 .. sourcecode:: python
   115 .. sourcecode:: python
   116 
   116 
   117     from cubicweb.schema import ERQLExpression
   117     from cubicweb.schema import ERQLExpression
   118 
   118 
   119     VISIBILITY_PERMISSIONS = {
   119     VISIBILITY_PERMISSIONS = {
   120 	'read':   ('managers',
   120         'read':   ('managers',
   121 		   ERQLExpression('X visibility "public"'),
   121                    ERQLExpression('X visibility "public"'),
   122 		   ERQLExpression('X may_be_read_by U')),
   122                    ERQLExpression('X may_be_read_by U')),
   123 	'add':    ('managers',),
   123         'add':    ('managers',),
   124 	'update': ('managers', 'owners',),
   124         'update': ('managers', 'owners',),
   125 	'delete': ('managers', 'owners'),
   125         'delete': ('managers', 'owners'),
   126 	}
   126         }
   127     AUTH_ONLY_PERMISSIONS = {
   127     AUTH_ONLY_PERMISSIONS = {
   128 	    'read':   ('managers', 'users'),
   128             'read':   ('managers', 'users'),
   129 	    'add':    ('managers',),
   129             'add':    ('managers',),
   130 	    'update': ('managers', 'owners',),
   130             'update': ('managers', 'owners',),
   131 	    'delete': ('managers', 'owners'),
   131             'delete': ('managers', 'owners'),
   132 	    }
   132             }
   133     CLASSIFIERS_PERMISSIONS = {
   133     CLASSIFIERS_PERMISSIONS = {
   134 	    'read':   ('managers', 'users', 'guests'),
   134             'read':   ('managers', 'users', 'guests'),
   135 	    'add':    ('managers',),
   135             'add':    ('managers',),
   136 	    'update': ('managers', 'owners',),
   136             'update': ('managers', 'owners',),
   137 	    'delete': ('managers', 'owners'),
   137             'delete': ('managers', 'owners'),
   138 	    }
   138             }
   139 
   139 
   140     from cubicweb_folder.schema import Folder
   140     from cubicweb_folder.schema import Folder
   141     from cubicweb_file.schema import File
   141     from cubicweb_file.schema import File
   142     from cubicweb_comment.schema import Comment
   142     from cubicweb_comment.schema import Comment
   143     from cubicweb_person.schema import Person
   143     from cubicweb_person.schema import Person