account.py 1.3 KB

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