account.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 = _("Account settings")
  9. name_changes_allowed = forms.IntegerField(
  10. label=_("Allowed username changes number"),
  11. min_value=0,
  12. initial=1)
  13. name_changes_expire = forms.IntegerField(
  14. label=_("Don't count username changes older than"),
  15. help_text=_("Number of days since name change that makes that change no longer count to limit. Enter zero to make all changes count."),
  16. min_value=0,
  17. initial=0)
  18. can_use_signature = forms.YesNoSwitch(
  19. label=_("Can have signature"),
  20. initial=True)
  21. allow_signature_links = forms.YesNoSwitch(
  22. label=_("Can put links in signature"),
  23. initial=True)
  24. allow_signature_images = forms.YesNoSwitch(
  25. label=_("Can put images in signature"),
  26. initial=False)
  27. def change_permissions_form(role):
  28. if isinstance(role, Role) and role.special_role != 'anonymous':
  29. return PermissionsForm
  30. else:
  31. return None
  32. """
  33. ACL Builder
  34. """
  35. def build_acl(acl, roles, key_name):
  36. pass