destroying.py 909 B

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