mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 14:42:25 +00:00
Helpful acl messages for default mixin.
This commit is contained in:
parent
9b3bc1d053
commit
592b969129
1 changed files with 25 additions and 25 deletions
|
@ -104,12 +104,12 @@ class AclMixin(object):
|
||||||
un object
|
un object
|
||||||
:param user_request: instance utilisateur qui fait la requête
|
:param user_request: instance utilisateur qui fait la requête
|
||||||
:return: soit True, soit False avec la raison de l'échec"""
|
:return: soit True, soit False avec la raison de l'échec"""
|
||||||
|
permission = cls.get_modulename() + '.add_' + cls.get_classname()
|
||||||
return (
|
return (
|
||||||
user_request.has_perm(
|
user_request.has_perm(permission),
|
||||||
cls.get_modulename() + '.add_' + cls.get_classname()
|
_("You don't have the right to create a %s object.")
|
||||||
),
|
% cls.get_classname(),
|
||||||
(_("You don't have the right to create a %s object.")
|
(permission,)
|
||||||
% cls.get_classname())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_edit(self, user_request, *_args, **_kwargs):
|
def can_edit(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -118,12 +118,12 @@ class AclMixin(object):
|
||||||
:param self: Instance à editer
|
:param self: Instance à editer
|
||||||
:param user_request: Utilisateur qui fait la requête
|
:param user_request: Utilisateur qui fait la requête
|
||||||
:return: soit True, soit False avec la raison de l'échec"""
|
:return: soit True, soit False avec la raison de l'échec"""
|
||||||
|
permission = self.get_modulename() + '.change_' + self.get_classname()
|
||||||
return (
|
return (
|
||||||
user_request.has_perm(
|
user_request.has_perm(permission),
|
||||||
self.get_modulename() + '.change_' + self.get_classname()
|
_("You don't have the right to edit a %s object.")
|
||||||
),
|
% self.get_classname(),
|
||||||
(_("You don't have the right to edit a %s object.")
|
(permission,)
|
||||||
% self.get_classname())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_delete(self, user_request, *_args, **_kwargs):
|
def can_delete(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -132,12 +132,12 @@ class AclMixin(object):
|
||||||
:param self: Instance à delete
|
:param self: Instance à delete
|
||||||
:param user_request: Utilisateur qui fait la requête
|
:param user_request: Utilisateur qui fait la requête
|
||||||
:return: soit True, soit False avec la raison de l'échec"""
|
:return: soit True, soit False avec la raison de l'échec"""
|
||||||
|
permission = self.get_modulename() + '.delete_' + self.get_classname()
|
||||||
return (
|
return (
|
||||||
user_request.has_perm(
|
user_request.has_perm(permission),
|
||||||
self.get_modulename() + '.delete_' + self.get_classname()
|
_("You don't have the right to delete a %s object.")
|
||||||
),
|
% self.get_classname(),
|
||||||
(_("You don't have the right to delete a %s object.")
|
(permission,)
|
||||||
% self.get_classname())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -146,12 +146,12 @@ class AclMixin(object):
|
||||||
droit particulier view objet correspondant
|
droit particulier view objet correspondant
|
||||||
:param user_request: instance user qui fait l'edition
|
:param user_request: instance user qui fait l'edition
|
||||||
:return: True ou False avec la raison de l'échec le cas échéant"""
|
:return: True ou False avec la raison de l'échec le cas échéant"""
|
||||||
|
permission = cls.get_modulename() + '.view_' + cls.get_classname()
|
||||||
return (
|
return (
|
||||||
user_request.has_perm(
|
user_request.has_perm(permission),
|
||||||
cls.get_modulename() + '.view_' + cls.get_classname()
|
_("You don't have the right to view every %s object.")
|
||||||
),
|
% cls.get_classname(),
|
||||||
(_("You don't have the right to view every %s object.")
|
(permission,)
|
||||||
% cls.get_classname())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -160,11 +160,11 @@ class AclMixin(object):
|
||||||
:param self: instance à voir
|
:param self: instance à voir
|
||||||
:param user_request: instance user qui fait l'edition
|
:param user_request: instance user qui fait l'edition
|
||||||
:return: True ou False avec la raison de l'échec le cas échéant"""
|
:return: True ou False avec la raison de l'échec le cas échéant"""
|
||||||
|
permission = self.get_modulename() + '.view_' + self.get_classname()
|
||||||
return (
|
return (
|
||||||
user_request.has_perm(
|
user_request.has_perm(permission),
|
||||||
self.get_modulename() + '.view_' + self.get_classname()
|
_("You don't have the right to view a %s object.")
|
||||||
),
|
% self.get_classname(),
|
||||||
(_("You don't have the right to view a %s object.")
|
(permission,)
|
||||||
% self.get_classname())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue