equal
deleted
inserted
replaced
172 .. _adv_tuto_security_propagation: |
172 .. _adv_tuto_security_propagation: |
173 |
173 |
174 Step 2: security propagation in hooks |
174 Step 2: security propagation in hooks |
175 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
175 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
176 |
176 |
177 To fullfill the requirements, we have to implement:: |
177 To fullfill the requirements defined earlier, we have to implement: |
178 |
178 |
179 Also, unless explicity specified, visibility of an image should be the same as |
179 Also, unless explicity specified, visibility of an image should be the same as |
180 its parent folder, as well as visibility of a comment should be the same as the |
180 its parent folder, as well as visibility of a comment should be the same as the |
181 commented entity. |
181 commented entity. |
182 |
182 |
346 folder = cnx.create_entity('Folder', |
346 folder = cnx.create_entity('Folder', |
347 name=u'restricted', |
347 name=u'restricted', |
348 visibility=u'restricted') |
348 visibility=u'restricted') |
349 photo1 = cnx.create_entity('File', |
349 photo1 = cnx.create_entity('File', |
350 data_name=u'photo1.jpg', |
350 data_name=u'photo1.jpg', |
351 data=Binary('xxx'), |
351 data=Binary(b'xxx'), |
352 filed_under=folder) |
352 filed_under=folder) |
353 |
353 |
354 cnx.commit() |
354 cnx.commit() |
355 |
355 |
356 # visibility propagation |
356 # visibility propagation |
357 self.assertEquals(photo1.visibility, 'restricted') |
357 self.assertEquals(photo1.visibility, 'restricted') |
358 |
358 |
359 # unless explicitly specified |
359 # unless explicitly specified |
360 photo2 = cnx.create_entity('File', |
360 photo2 = cnx.create_entity('File', |
361 data_name=u'photo2.jpg', |
361 data_name=u'photo2.jpg', |
362 data=Binary('xxx'), |
362 data=Binary(b'xxx'), |
363 visibility=u'public', |
363 visibility=u'public', |
364 filed_under=folder) |
364 filed_under=folder) |
365 |
365 |
366 cnx.commit() |
366 cnx.commit() |
367 |
367 |