Exemplo n.º 1
0
    def __init__(self, *args):
        base.Renderer.__init__(self, *args)
        self.users = SessionUsers(self.context)
        self.current_user = self.users.current()
        self.admin = AdminUtil(self.context)

        self.has_permission = self.admin.has_permission(self.current_user)
        self.can_add = self.admin.can_act('new')

        can_modify = self.admin.can_act('modify')
        self.can_modify = self.has_permission and can_modify
Exemplo n.º 2
0
    def __init__(self, *args):
        base.Renderer.__init__(self, *args)
        self.users = SessionUsers(self.context)
        self.current_user = self.users.current()
        self.admin = AdminUtil(self.context)

        self.has_permission = self.admin.has_permission(self.current_user)
        self.can_add = self.admin.can_act('new')

        can_modify = self.admin.can_act('modify')
        self.can_modify = self.has_permission and can_modify
Exemplo n.º 3
0
class Renderer(base.Renderer):
    '''Renderer del portlet'''
    render = ViewPageTemplateFile('actions.pt')

    def __init__(self, *args):
        base.Renderer.__init__(self, *args)
        self.users = SessionUsers(self.context)
        self.current_user = self.users.current()
        self.admin = AdminUtil(self.context)

        self.has_permission = self.admin.has_permission(self.current_user)
        self.can_add = self.admin.can_act('new')

        can_modify = self.admin.can_act('modify')
        self.can_modify = self.has_permission and can_modify
        #can_change_password = self.admin.can_act('password')
        #self.can_change_password = self.has_permission and can_change_password

    def can_change_password(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('password')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and not is_suspended

    def can_suspend(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('suspend')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and not is_suspended

    def can_reactivate(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('reactivate')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and is_suspended

    def _is_suspended(self):
        pwd = self.current_user.get('userPassword', None)
        if pwd is None:
            return None
        return '*' in pwd
Exemplo n.º 4
0
class Renderer(base.Renderer):
    '''Renderer del portlet'''
    render = ViewPageTemplateFile('actions.pt')

    def __init__(self, *args):
        base.Renderer.__init__(self, *args)
        self.users = SessionUsers(self.context)
        self.current_user = self.users.current()
        self.admin = AdminUtil(self.context)

        self.has_permission = self.admin.has_permission(self.current_user)
        self.can_add = self.admin.can_act('new')

        can_modify = self.admin.can_act('modify')
        self.can_modify = self.has_permission and can_modify
        #can_change_password = self.admin.can_act('password')
        #self.can_change_password = self.has_permission and can_change_password

    def can_change_password(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('password')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and not is_suspended

    def can_suspend(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('suspend')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and not is_suspended

    def can_reactivate(self):
        if self.current_user is None:
            return False
        _can_act = self.admin.can_act('reactivate')
        is_suspended = self._is_suspended()
        return self.has_permission and _can_act and is_suspended

    def _is_suspended(self):
        pwd = self.current_user.get('userPassword', None)
        if pwd is None:
            return None
        return '*' in pwd