fixtures.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. from misago.forumroles.models import ForumRole
  2. from misago.utils import ugettext_lazy as _
  3. from misago.utils import get_msgid
  4. def load_fixtures():
  5. role = ForumRole()
  6. role.name = _('Full Access').message
  7. role.set_permissions({
  8. 'can_see_forum': True,
  9. 'can_see_forum_contents': True,
  10. 'can_read_threads': 2,
  11. 'can_start_threads': 2,
  12. 'can_edit_own_threads': True,
  13. 'can_soft_delete_own_threads': True,
  14. 'can_write_posts': 2,
  15. 'can_edit_own_posts': True,
  16. 'can_soft_delete_own_posts': True,
  17. 'can_upvote_posts': True,
  18. 'can_downvote_posts': True,
  19. 'can_see_posts_scores': True,
  20. 'can_see_votes': True,
  21. 'can_make_polls': True,
  22. 'can_vote_in_polls': True,
  23. 'can_see_poll_votes': True,
  24. 'can_see_attachments': True,
  25. 'can_upload_attachments': True,
  26. 'can_download_attachments': True,
  27. 'attachment_size': 5000,
  28. 'attachment_limit': 15,
  29. 'can_approve': True,
  30. 'can_edit_labels': True,
  31. 'can_see_changelog': True,
  32. 'can_pin_threads': 2,
  33. 'can_edit_threads_posts': True,
  34. 'can_move_threads_posts': True,
  35. 'can_close_threads': True,
  36. 'can_protect_posts': True,
  37. 'can_delete_threads': 2,
  38. 'can_delete_posts': 2,
  39. 'can_delete_polls': 2,
  40. 'can_delete_attachments': True,
  41. })
  42. role.save(force_insert=True)
  43. role = ForumRole()
  44. role.name = _('Standard Access and Upload').message
  45. role.set_permissions({
  46. 'can_see_forum': True,
  47. 'can_see_forum_contents': True,
  48. 'can_read_threads': 2,
  49. 'can_start_threads': 2,
  50. 'can_edit_own_threads': True,
  51. 'can_write_posts': 2,
  52. 'can_edit_own_posts': True,
  53. 'can_soft_delete_own_posts': True,
  54. 'can_upvote_posts': True,
  55. 'can_downvote_posts': True,
  56. 'can_make_polls': True,
  57. 'can_vote_in_polls': True,
  58. 'can_upload_attachments': True,
  59. 'can_download_attachments': True,
  60. 'attachment_size': 100,
  61. 'attachment_limit': 3,
  62. })
  63. role.save(force_insert=True)
  64. role = ForumRole()
  65. role.name = _('Standard Access').message
  66. role.set_permissions({
  67. 'can_see_forum': True,
  68. 'can_see_forum_contents': True,
  69. 'can_read_threads': 2,
  70. 'can_start_threads': 2,
  71. 'can_edit_own_threads': True,
  72. 'can_write_posts': 2,
  73. 'can_edit_own_posts': True,
  74. 'can_soft_delete_own_posts': True,
  75. 'can_upvote_posts': True,
  76. 'can_downvote_posts': True,
  77. 'can_make_polls': True,
  78. 'can_vote_in_polls': True,
  79. 'can_download_attachments': True,
  80. })
  81. role.save(force_insert=True)
  82. role = ForumRole()
  83. role.name = _('Read and Download').message
  84. role.set_permissions({
  85. 'can_see_forum': True,
  86. 'can_see_forum_contents': True,
  87. 'can_read_threads': 2,
  88. 'can_download_attachments': True,
  89. })
  90. role.save(force_insert=True)
  91. role = ForumRole()
  92. role.name = _('Threads list only').message
  93. role.set_permissions({
  94. 'can_see_forum': True,
  95. 'can_see_forum_contents': True,
  96. })
  97. role.save(force_insert=True)
  98. role = ForumRole()
  99. role.name = _('Read only').message
  100. role.set_permissions({
  101. 'can_see_forum': True,
  102. 'can_see_forum_contents': True,
  103. 'can_read_threads': 2,
  104. })
  105. role.save(force_insert=True)