Exemple #1
0
class PermissionsForm(forms.Form):
    legend = _("Deleting users")

    can_delete_users_newer_than = forms.IntegerField(
        label=_("Maximum age of deleted account (in days)"),
        help_text=_("Enter zero to disable this check."),
        min_value=0,
        initial=0)
    can_delete_users_with_less_posts_than = forms.IntegerField(
        label=_("Maximum number of posts on deleted account"),
        help_text=_("Enter zero to disable this check."),
        min_value=0,
        initial=0)
Exemple #2
0
class RolePermissionsForm(forms.Form):
    legend = _("Threads")

    can_download_other_users_attachments = forms.YesNoSwitch(
        label=_("Can download other users attachments"))
    max_attachment_size = forms.IntegerField(
        label=_("Max attached file size (in kb)"),
        help_text=_("Enter 0 to disable attachments."),
        initial=500,
        min_value=0)
    can_delete_other_users_attachments = forms.YesNoSwitch(
        label=_("Can delete other users attachments"))

    can_see_unapproved_content_lists = forms.YesNoSwitch(
        label=_("Can see unapproved content list"),
        help_text=_('Allows access to "unapproved" tab on threads lists for '
                    "easy listing of threads that are unapproved or contain "
                    "unapproved posts. Despite the tab being available on all "
                    "threads lists, it will only display threads belonging to "
                    "categories in which the user has permission to approve "
                    "content."))
    can_see_reported_content_lists = forms.YesNoSwitch(
        label=_("Can see reported content list"),
        help_text=_('Allows access to "reported" tab on threads lists for '
                    "easy listing of threads that contain reported posts. "
                    "Despite the tab being available on all categories "
                    "threads lists, it will only display threads belonging to "
                    "categories in which the user has permission to see posts "
                    "reports."))
    can_omit_flood_protection = forms.YesNoSwitch(
        label=_("Can omit flood protection"),
        help_text=_(
            "Allows posting more frequently than flood protection would."))
Exemple #3
0
class PermissionsForm(forms.Form):
    legend = _("Private threads")

    can_use_private_threads = forms.YesNoSwitch(
        label=_("Can use private threads"))
    can_start_private_threads = forms.YesNoSwitch(
        label=_("Can start private threads"))

    max_private_thread_participants = forms.IntegerField(
        label=_("Max number of users invited to private thread"),
        help_text=_("Enter 0 to don't limit number of participants."),
        initial=3,
        min_value=0
    )

    can_add_everyone_to_private_threads = forms.YesNoSwitch(
        label=_("Can add everyone to threads"),
        help_text=_("Allows user to add users that are "
                    "blocking him to private threads.")
    )

    can_report_private_threads = forms.YesNoSwitch(
        label=_("Can report private threads"),
        help_text=_("Allows user to report private threads they are "
                    "participating in, making them accessible to moderators.")
    )

    can_moderate_private_threads = forms.YesNoSwitch(
        label=_("Can moderate private threads"),
        help_text=_("Allows user to read, reply, edit and delete "
                "content in reported private threads.")
    )
Exemple #4
0
class RolePermissionsForm(forms.Form):
    legend = _("Polls")

    can_start_polls = forms.TypedChoiceField(label=_("Can start polls"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Own threads")),
                                                      (2, _("All threads"))))
    can_edit_polls = forms.TypedChoiceField(label=_("Can edit polls"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own polls")),
                                                     (2, _("All polls"))))
    can_delete_polls = forms.TypedChoiceField(label=_("Can delete polls"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own polls")),
                                                       (2, _("All polls"))))
    poll_edit_time = forms.IntegerField(
        label=_("Time limit for own polls edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own polls."),
        initial=0,
        min_value=0)
    can_always_see_poll_voters = forms.YesNoSwitch(
        label=_("Can always see polls voters"),
        help_text=
        _("Allows users to see who voted in poll even if poll votes are secret."
          ))
Exemple #5
0
class WarningLevelForm(forms.ModelForm):
    name = forms.CharField(label=_("Level name"), max_length=255)
    length_in_minutes = forms.IntegerField(
        label=_("Length in minutes"),
        min_value=0,
        help_text=_("Enter number of minutes since this warning level was "
                    "imposed on member until it's reduced, or 0 to make "
                    "this warning level permanent.")
    )
    restricts_posting_replies = forms.TypedChoiceField(
        label=_("Posting replies"),
        coerce=int,
        choices=RESTRICTIONS_CHOICES
    )
    restricts_posting_threads = forms.TypedChoiceField(
        label=_("Posting threads"),
        coerce=int,
        choices=RESTRICTIONS_CHOICES
    )

    class Meta:
        model = WarningLevel
        fields = [
            'name',
            'length_in_minutes',
            'restricts_posting_replies',
            'restricts_posting_threads',
        ]
Exemple #6
0
class PermissionsForm(forms.Form):
    legend = _("Users moderation")

    can_rename_users = forms.YesNoSwitch(label=_("Can rename users"))
    can_moderate_avatars = forms.YesNoSwitch(label=_("Can moderate avatars"))
    can_moderate_signatures = forms.YesNoSwitch(
        label=_("Can moderate signatures"))
    can_ban_users = forms.YesNoSwitch(label=_("Can ban users"))
    max_ban_length = forms.IntegerField(
        label=_("Max length, in days, of imposed ban"),
        help_text=_("Enter zero to let moderators impose permanent bans."),
        min_value=0,
        initial=0)
    can_lift_bans = forms.YesNoSwitch(label=_("Can lift bans"))
    max_lifted_ban_length = forms.IntegerField(
        label=_("Max length, in days, of lifted ban"),
        help_text=_("Enter zero to let moderators lift permanent bans."),
        min_value=0,
        initial=0)
Exemple #7
0
class PermissionsForm(forms.Form):
    legend = _("Account settings")

    name_changes_allowed = forms.IntegerField(
        label=_("Allowed username changes number"), min_value=0, initial=1)
    name_changes_expire = forms.IntegerField(
        label=_("Don't count username changes older than"),
        help_text=_("Number of days since name change that makes "
                    "that change no longer count to limit. Enter "
                    "zero to make all changes count."),
        min_value=0,
        initial=0)
    can_have_signature = forms.YesNoSwitch(label=_("Can have signature"))
    allow_signature_links = forms.YesNoSwitch(
        label=_("Can put links in signature"))
    allow_signature_images = forms.YesNoSwitch(
        label=_("Can put images in signature"))
    allow_signature_blocks = forms.YesNoSwitch(
        label=_("Can use text blocks in signature"),
        help_text=_("Controls whether or not users can put quote, code, "
                    "spoiler blocks and horizontal lines in signatures."))
Exemple #8
0
class PermissionsForm(forms.Form):
    legend = _("Attachments")

    max_attachment_size = forms.IntegerField(
        label=_("Max attached file size (in kb)"),
        help_text=_("Enter 0 to disable attachments."),
        initial=500,
        min_value=0)

    can_download_other_users_attachments = forms.YesNoSwitch(
        label=_("Can download other users attachments"))
    can_delete_other_users_attachments = forms.YesNoSwitch(
        label=_("Can delete other users attachments"))
Exemple #9
0
def create_text(setting, kwargs, extra):
    kwargs.update(extra)
    if setting.python_type == 'int':
        return forms.IntegerField(**kwargs)
    else:
        return forms.CharField(**kwargs)
Exemple #10
0
class CategoryPermissionsForm(forms.Form):
    legend = _("Threads")

    can_see_all_threads = forms.TypedChoiceField(
        label=_("Can see threads"),
        coerce=int,
        initial=0,
        choices=((0, _("Started threads")), (1, _("All threads"))))

    can_start_threads = forms.YesNoSwitch(label=_("Can start threads"))
    can_reply_threads = forms.YesNoSwitch(label=_("Can reply to threads"))

    can_edit_threads = forms.TypedChoiceField(label=_("Can edit threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own threads")),
                                                       (2, _("All threads"))))
    can_hide_own_threads = forms.TypedChoiceField(
        label=_("Can hide own threads"),
        help_text=_("Only threads started within time limit and "
                    "with no replies can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide threads")), (2,
                                                        _("Delete threads"))))
    thread_edit_time = forms.IntegerField(
        label=_("Time limit for own threads edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own threads."),
        initial=0,
        min_value=0)
    can_hide_threads = forms.TypedChoiceField(label=_("Can hide all threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Hide threads")),
                                                       (2,
                                                        _("Delete threads"))))

    can_pin_threads = forms.TypedChoiceField(label=_("Can pin threads"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Locally")),
                                                      (2, _("Globally"))))
    can_close_threads = forms.YesNoSwitch(label=_("Can close threads"))
    can_move_threads = forms.YesNoSwitch(label=_("Can move threads"))
    can_merge_threads = forms.YesNoSwitch(label=_("Can merge threads"))

    can_edit_posts = forms.TypedChoiceField(label=_("Can edit posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own posts")),
                                                     (2, _("All posts"))))
    can_hide_own_posts = forms.TypedChoiceField(
        label=_("Can hide own posts"),
        help_text=
        _("Only last posts to thread made within edit time limit can be hidden."
          ),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide posts")), (2, _("Delete posts"))))
    post_edit_time = forms.IntegerField(
        label=_("Time limit for own post edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own posts."),
        initial=0,
        min_value=0)
    can_hide_posts = forms.TypedChoiceField(label=_("Can hide all posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Hide posts")),
                                                     (2, _("Delete posts"))))

    can_see_posts_likes = forms.TypedChoiceField(
        label=_("Can see posts likes"),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Number only")),
                 (2, _("Number and list of likers"))))
    can_like_posts = forms.YesNoSwitch(label=_("Can like posts"))

    can_protect_posts = forms.YesNoSwitch(
        label=_("Can protect posts"),
        help_text=_(
            "Only users with this permission can edit protected posts."))
    can_move_posts = forms.YesNoSwitch(
        label=_("Can move posts"),
        help_text=_("Will be able to move posts to other threads."))
    can_merge_posts = forms.YesNoSwitch(label=_("Can merge posts"))
    can_approve_content = forms.YesNoSwitch(
        label=_("Can approve content"),
        help_text=_("Will be able to see and approve unapproved content."))
    can_report_content = forms.YesNoSwitch(label=_("Can report posts"))
    can_see_reports = forms.YesNoSwitch(label=_("Can see reports"))

    can_hide_events = forms.TypedChoiceField(label=_("Can hide events"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Hide events")),
                                                      (2, _("Delete events"))))
Exemple #11
0
class PermissionsForm(forms.Form):
    legend = _("Threads")

    can_see_all_threads = forms.TypedChoiceField(
        label=_("Can see threads"),
        coerce=int,
        initial=0,
        choices=((0, _("Started threads")), (1, _("All threads"))))
    can_start_threads = forms.YesNoSwitch(label=_("Can start threads"))
    can_reply_threads = forms.YesNoSwitch(label=_("Can reply to threads"))
    can_edit_threads = forms.TypedChoiceField(label=_("Can edit threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Own threads")),
                                                       (2, _("All threads"))))
    can_hide_own_threads = forms.TypedChoiceField(
        label=_("Can hide own threads"),
        help_text=_("Only threads started within time limit and "
                    "with no replies can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide threads")), (2,
                                                        _("Delete threads"))))
    thread_edit_time = forms.IntegerField(
        label=_("Time limit for own threads edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own threads."),
        initial=0,
        min_value=0)
    can_hide_threads = forms.TypedChoiceField(label=_("Can hide all threads"),
                                              coerce=int,
                                              initial=0,
                                              choices=((0, _("No")),
                                                       (1, _("Hide threads")),
                                                       (2,
                                                        _("Delete threads"))))
    can_edit_posts = forms.TypedChoiceField(label=_("Can edit posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Own posts")),
                                                     (2, _("All posts"))))
    can_hide_own_posts = forms.TypedChoiceField(
        label=_("Can hide own posts"),
        help_text=_("Only last posts to thread made within "
                    "edit time limit can be hidden."),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Hide posts")), (2, _("Delete posts"))))
    post_edit_time = forms.IntegerField(
        label=_("Time limit for own post edits, in minutes"),
        help_text=_("Enter 0 to don't limit time for editing own posts."),
        initial=0,
        min_value=0)
    can_hide_posts = forms.TypedChoiceField(label=_("Can hide all posts"),
                                            coerce=int,
                                            initial=0,
                                            choices=((0, _("No")),
                                                     (1, _("Hide posts")),
                                                     (2, _("Delete posts"))))
    can_protect_posts = forms.YesNoSwitch(
        label=_("Can protect posts"),
        help_text=_("Only users with this permission "
                    "can edit protected posts."))
    can_move_posts = forms.YesNoSwitch(label=_("Can move posts"))
    can_merge_posts = forms.YesNoSwitch(label=_("Can merge posts"))
    can_change_threads_labels = forms.TypedChoiceField(
        label=_("Can change threads labels"),
        coerce=int,
        initial=0,
        choices=((0, _("No")), (1, _("Own threads")), (2, _("All threads"))))
    can_pin_threads = forms.YesNoSwitch(label=_("Can pin threads"))
    can_close_threads = forms.YesNoSwitch(label=_("Can close threads"))
    can_move_threads = forms.YesNoSwitch(label=_("Can move threads"))
    can_merge_threads = forms.YesNoSwitch(label=_("Can merge threads"))
    can_split_threads = forms.YesNoSwitch(label=_("Can split threads"))
    can_review_moderated_content = forms.YesNoSwitch(
        label=_("Can review moderated content"),
        help_text=_("Will see and be able to accept moderated content."))
    can_report_content = forms.YesNoSwitch(label=_("Can report posts"))
    can_see_reports = forms.YesNoSwitch(label=_("Can see reports"))
    can_hide_events = forms.TypedChoiceField(label=_("Can hide events"),
                                             coerce=int,
                                             initial=0,
                                             choices=((0, _("No")),
                                                      (1, _("Hide events")),
                                                      (2, _("Delete events"))))