destroying.py 976 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. from django.utils.translation import ugettext_lazy as _
  2. from misago.acl.models import Role
  3. from misago.core import forms
  4. DEFAULT_PERMISSIONS = {
  5. 'can_destroy_user_newer_than': 0,
  6. 'can_destroy_users_with_less_posts_than': 0,
  7. }
  8. """
  9. Admin Permissions Form
  10. """
  11. class PermissionsForm(forms.Form):
  12. legend = _("Destroying user accounts")
  13. can_destroy_user_newer_than = forms.IntegerField(
  14. label=_("Maximum age of destroyed account (in days)"),
  15. help_text=_("Enter zero to disable this check."),
  16. min_value=0)
  17. can_destroy_users_with_less_posts_than = forms.IntegerField(
  18. label=_("Maximum number of posts on destroyed account"),
  19. help_text=_("Enter zero to disable this check."),
  20. min_value=0)
  21. def change_permissions_form(role):
  22. if isinstance(role, Role) and role.special_role != 'anonymous':
  23. return PermissionsForm
  24. else:
  25. return None
  26. """
  27. ACL Builder
  28. """
  29. def build_acl(acl, roles):
  30. pass