# HG changeset patch # User verrierj # Date 1328200794 -3600 # Node ID d1be4a4f66399165aa0d8d568d1198f6ace738a9 # Parent d7a40f4dc38b0dd4c1c2c9cbfd1abb46d49b8e5a Fix bugs in permissions diff -r d7a40f4dc38b -r d1be4a4f6639 src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Thu Feb 02 16:12:46 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/models.py Thu Feb 02 17:39:54 2012 +0100 @@ -224,7 +224,10 @@ create_front_project = True if not self.nb_annotation: - self.nb_annotation = 0 + self.nb_annotation = 0 + if not self.stat_annotation: + self.stat_annotation = self.__list2str([0] * (settings.DIVISIONS_FOR_STAT_ANNOTATION + len(settings.SYNTAX.keys()))) + super(Content, self).save(*args, **kwargs) @@ -373,10 +376,10 @@ set_current_user(admin) self.front_project = Project.create_project(admin, 'front project : %s' % self.title, [self], cuttings=['chapitrage', 'contributions'] ) - self.front_project.publish(allow_write=True) + self.front_project.publish(allow_write=True) + self.save() set_current_user(old_user) - - self.save() + # Tag management def get_tags(self): diff -r d7a40f4dc38b -r d1be4a4f6639 src/ldt/ldt/ldt_utils/views/content.py --- a/src/ldt/ldt/ldt_utils/views/content.py Thu Feb 02 16:12:46 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/content.py Thu Feb 02 17:39:54 2012 +0100 @@ -222,8 +222,8 @@ if media: cached_assign('view_media', everyone, media) else: - remove_perm('view_content', everyone, content) - remove_perm('view_media', everyone, media) + remove_perm('ldt_utils.view_content', everyone, content) + remove_perm('ldt_utils.view_media', everyone, media) assign_perm_to_obj(content, content_form.cleaned_data['read_list'], content_form.cleaned_data['write_list'], request.user) if media: assign_perm_to_obj(media, content_form.cleaned_data['read_list'], content_form.cleaned_data['write_list'], request.user) diff -r d7a40f4dc38b -r d1be4a4f6639 src/ldt/ldt/security/command.py --- a/src/ldt/ldt/security/command.py Thu Feb 02 16:12:46 2012 +0100 +++ b/src/ldt/ldt/security/command.py Thu Feb 02 17:39:54 2012 +0100 @@ -28,8 +28,12 @@ total = list_model['Project'].objects.count() for proj in list_model['Project'].objects.all(): - assign('ldt_utils.change_project', proj.owner, proj) - assign('ldt_utils.view_project', proj.owner, proj) + + if proj.state == 2: + proj.publish() + else: + proj.unpublish() + if verbose: show_progress(i, total, "Assign permissions to projects", 40, writer) i += 1