summaryrefslogtreecommitdiff
path: root/ishtar_common/menu_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/menu_base.py')
-rw-r--r--ishtar_common/menu_base.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/ishtar_common/menu_base.py b/ishtar_common/menu_base.py
index e8470787a..e0f206a57 100644
--- a/ishtar_common/menu_base.py
+++ b/ishtar_common/menu_base.py
@@ -43,28 +43,28 @@ class SectionItem:
return False
return True
- def can_be_available(self, user, session=None):
+ def can_be_available(self, user):
if not self.check_profile_restriction():
return False
if not self.childs:
return True
for child in self.childs:
- if child.can_be_available(user, session=session):
+ if child.can_be_available(user):
return True
return False
- def is_available(self, user, obj=None, session=None):
+ def is_available(self, user, obj=None):
if not self.childs:
return True
for child in self.childs:
- if child.is_available(user, obj, session=session):
+ if child.is_available(user, obj):
return True
return False
def set_items(self, user, items, current_action=None, session=None):
selected = None
if user:
- self.available = self.can_be_available(user, session=session)
+ self.available = self.can_be_available(user)
for child in self.childs:
selected = (
child.set_items(user, items, current_action, session=session)
@@ -101,35 +101,37 @@ class MenuItem:
return False
return True
- def can_be_available(self, user, session=None):
+ def can_be_available(self, user):
if not self.check_profile_restriction():
return False
if not self.access_controls:
return True
if not hasattr(user, "ishtaruser"):
return False
+ ishtaruser = user.ishtaruser
for access_control in self.access_controls:
# check by profile
- if user.ishtaruser.person.has_right(access_control, session=session):
+ if ishtaruser.has_permission(access_control):
return True
return False
- def is_available(self, user, obj=None, session=None):
+ def is_available(self, user, obj=None):
if not self.check_profile_restriction():
return False
if not self.access_controls:
return True
if not hasattr(user, "ishtaruser"):
return False
+ ishtaruser = user.ishtaruser
for access_control in self.access_controls:
- if user.ishtaruser.person.has_right(
- access_control, obj=obj, session=session
+ if ishtaruser.has_permission(
+ access_control, obj=obj
):
return True
return False
def set_items(self, user, items, current_action=None, session=None):
if user:
- self.available = self.can_be_available(user, session=session)
+ self.available = self.can_be_available(user)
if self.idx == current_action:
return True