mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +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
|
||||
:param user_request: instance utilisateur qui fait la requête
|
||||
:return: soit True, soit False avec la raison de l'échec"""
|
||||
permission = cls.get_modulename() + '.add_' + cls.get_classname()
|
||||
return (
|
||||
user_request.has_perm(
|
||||
cls.get_modulename() + '.add_' + cls.get_classname()
|
||||
),
|
||||
(_("You don't have the right to create a %s object.")
|
||||
% cls.get_classname())
|
||||
user_request.has_perm(permission),
|
||||
_("You don't have the right to create a %s object.")
|
||||
% cls.get_classname(),
|
||||
(permission,)
|
||||
)
|
||||
|
||||
def can_edit(self, user_request, *_args, **_kwargs):
|
||||
|
@ -118,12 +118,12 @@ class AclMixin(object):
|
|||
:param self: Instance à editer
|
||||
:param user_request: Utilisateur qui fait la requête
|
||||
:return: soit True, soit False avec la raison de l'échec"""
|
||||
permission = self.get_modulename() + '.change_' + self.get_classname()
|
||||
return (
|
||||
user_request.has_perm(
|
||||
self.get_modulename() + '.change_' + self.get_classname()
|
||||
),
|
||||
(_("You don't have the right to edit a %s object.")
|
||||
% self.get_classname())
|
||||
user_request.has_perm(permission),
|
||||
_("You don't have the right to edit a %s object.")
|
||||
% self.get_classname(),
|
||||
(permission,)
|
||||
)
|
||||
|
||||
def can_delete(self, user_request, *_args, **_kwargs):
|
||||
|
@ -132,12 +132,12 @@ class AclMixin(object):
|
|||
:param self: Instance à delete
|
||||
:param user_request: Utilisateur qui fait la requête
|
||||
:return: soit True, soit False avec la raison de l'échec"""
|
||||
permission = self.get_modulename() + '.delete_' + self.get_classname()
|
||||
return (
|
||||
user_request.has_perm(
|
||||
self.get_modulename() + '.delete_' + self.get_classname()
|
||||
),
|
||||
(_("You don't have the right to delete a %s object.")
|
||||
% self.get_classname())
|
||||
user_request.has_perm(permission),
|
||||
_("You don't have the right to delete a %s object.")
|
||||
% self.get_classname(),
|
||||
(permission,)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@ -146,12 +146,12 @@ class AclMixin(object):
|
|||
droit particulier view objet correspondant
|
||||
:param user_request: instance user qui fait l'edition
|
||||
:return: True ou False avec la raison de l'échec le cas échéant"""
|
||||
permission = cls.get_modulename() + '.view_' + cls.get_classname()
|
||||
return (
|
||||
user_request.has_perm(
|
||||
cls.get_modulename() + '.view_' + cls.get_classname()
|
||||
),
|
||||
(_("You don't have the right to view every %s object.")
|
||||
% cls.get_classname())
|
||||
user_request.has_perm(permission),
|
||||
_("You don't have the right to view every %s object.")
|
||||
% cls.get_classname(),
|
||||
(permission,)
|
||||
)
|
||||
|
||||
def can_view(self, user_request, *_args, **_kwargs):
|
||||
|
@ -160,11 +160,11 @@ class AclMixin(object):
|
|||
:param self: instance à voir
|
||||
:param user_request: instance user qui fait l'edition
|
||||
:return: True ou False avec la raison de l'échec le cas échéant"""
|
||||
permission = self.get_modulename() + '.view_' + self.get_classname()
|
||||
return (
|
||||
user_request.has_perm(
|
||||
self.get_modulename() + '.view_' + self.get_classname()
|
||||
),
|
||||
(_("You don't have the right to view a %s object.")
|
||||
% self.get_classname())
|
||||
user_request.has_perm(permission),
|
||||
_("You don't have the right to view a %s object.")
|
||||
% self.get_classname(),
|
||||
(permission,)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue