0007_best_answers_roles.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # -*- coding: utf-8 -*-
  2. # Generated by Django 1.11.9 on 2018-03-18 20:40
  3. from __future__ import unicode_literals
  4. from django.db import migrations
  5. _ = lambda s: s
  6. def create_default_categories_roles(apps, schema_editor):
  7. CategoryRole = apps.get_model('misago_categories', 'CategoryRole')
  8. CategoryRole.objects.create(
  9. name=_("Start and reply threads, mark best answers"),
  10. permissions={
  11. # best answers perms
  12. 'misago.threads.permissions.bestanswers': {
  13. 'can_mark_best_answers': 1,
  14. 'can_change_marked_answers': 1,
  15. 'best_answer_change_time': 60 * 36, # 1.5 day
  16. },
  17. # categories perms
  18. 'misago.categories.permissions': {
  19. 'can_see': 1,
  20. 'can_browse': 1,
  21. },
  22. # threads perms
  23. 'misago.threads.permissions.threads': {
  24. 'can_see_all_threads': 1,
  25. 'can_start_threads': 1,
  26. 'can_reply_threads': 1,
  27. 'can_edit_threads': 1,
  28. 'can_edit_posts': 1,
  29. 'can_download_other_users_attachments': 1,
  30. 'max_attachment_size': 500,
  31. 'can_see_posts_likes': 2,
  32. 'can_like_posts': 1
  33. },
  34. }
  35. )
  36. CategoryRole.objects.create(
  37. name=_("Best answers moderator"),
  38. permissions={
  39. # best answers perms
  40. 'misago.threads.permissions.bestanswers': {
  41. 'can_mark_best_answers': 2,
  42. 'can_change_marked_answers': 2,
  43. 'best_answer_change_time': 0,
  44. },
  45. # categories perms
  46. 'misago.categories.permissions': {
  47. 'can_see': 1,
  48. 'can_browse': 1
  49. },
  50. # threads perms
  51. 'misago.threads.permissions.threads': {
  52. 'can_see_all_threads': 1,
  53. 'can_start_threads': 1,
  54. 'can_reply_threads': 1,
  55. 'can_edit_threads': 2,
  56. 'can_edit_posts': 2,
  57. 'can_hide_own_threads': 2,
  58. 'can_hide_own_posts': 2,
  59. 'thread_edit_time': 0,
  60. 'post_edit_time': 0,
  61. 'can_hide_threads': 2,
  62. 'can_hide_posts': 2,
  63. 'can_protect_posts': 1,
  64. 'can_move_posts': 1,
  65. 'can_merge_posts': 1,
  66. 'can_announce_threads': 1,
  67. 'can_pin_threads': 2,
  68. 'can_close_threads': 1,
  69. 'can_move_threads': 1,
  70. 'can_merge_threads': 1,
  71. 'can_approve_content': 1,
  72. 'can_download_other_users_attachments': 1,
  73. 'max_attachment_size': 2500,
  74. 'can_delete_other_users_attachments': 1,
  75. 'can_see_posts_likes': 2,
  76. 'can_like_posts': 1,
  77. 'can_report_content': 1,
  78. 'can_see_reports': 1,
  79. 'can_hide_events': 2
  80. },
  81. }
  82. )
  83. class Migration(migrations.Migration):
  84. dependencies = [
  85. ('misago_categories', '0006_moderation_queue_roles'),
  86. ]
  87. operations = [
  88. migrations.RunPython(create_default_categories_roles),
  89. ]