Exemplo n.º 1
0
def __validate_role_constraints(session):
    for role_constraint in session.user.role_constraints:
        result = __validate_role_constraint(session, role_constraint)
        if result is not SUCCESS:
            logger.debug('validate_role_constraints deactivate user-role:' +
                         session.user.uid + '.' + role_constraint.name +
                         ', result=' + str(result))
            __deactivate_role(session.user, role_constraint)
Exemplo n.º 2
0
def _open_admin():
    try:
        with _srv_pool.connection() as conn:
            c = conn
    except Exception as e:
        raise LdapException('connutl.open Exception=' + str(e))
    if (_ldap_debug):
        logger.debug(c.usage)
    return c
Exemplo n.º 3
0
def __validate_role_constraint(session, constraint):
    result = SUCCESS
    if __is_constraint(constraint):
        for validator in validators:
            result = validator.validate(constraint, CurrentDateTime(), session)
            if result is not SUCCESS:
                logger.debug(validator.__class__.__name__ +
                             ' validation failed:' + constraint.name +
                             ', uid=' + session.user.uid + ', result=' +
                             str(result))
                break
    return result
Exemplo n.º 4
0
def __validate_user_constraint(session, op):
    result = SUCCESS
    if __is_constraint(session.user.constraint):
        for validator in validators:
            result = validator.validate(session.user.constraint,
                                        CurrentDateTime(), session)
            if result is not SUCCESS:
                logger.debug(validator.__class__.__name__ +
                             ' validation failed:' +
                             session.user.constraint.name + ', result=' +
                             str(result))
                raise RbacError(msg=op + ' constraint validation failed uid:' +
                                session.user.uid,
                                id=result)
    return result
Exemplo n.º 5
0
def open():
    c = _open_admin()
    if (_ldap_debug):
        logger.debug(c.usage)
    return c