Example #1
0
    if settings.has_option('roles', 'all'):
        all_s = settings.get('roles', 'all')
        if all_s == 'disabled':
            all_enabled = False
        elif not all_s == 'enabled':
            print("invalid value '%s' for all parameters, all role will be "
                  "enabled." % (all_s))

    users = settings.get('roles', 'user').split(',')
    admins = settings.get('roles', 'admin').split(',')


# retrieve ACLs for views if exist in configuration
try:
    acl = settings.items('acl')
except NoSectionError:
    acl = []


def get_ldap_connection():

    uri = settings.get('ldap', 'uri')
    conn = ldap.initialize(uri)

    # LDAP/SSL setup
    if uri.startswith('ldaps'):

        conn.protocol_version = ldap.VERSION3
        # Force libldap to create a new SSL context
        conn.set_option(ldap.OPT_X_TLS_NEWCTX, ldap.OPT_X_TLS_DEMAND)
Example #2
0
    }

    if settings.has_option('roles', 'all'):
        all_s = settings.get('roles', 'all')
        if all_s == 'disabled':
            all_enabled = False
        elif not all_s == 'enabled':
            print("invalid value '%s' for all parameters, all role will be "
                  "enabled." % (all_s))

    users = settings.get('roles', 'user').split(',')
    admins = settings.get('roles', 'admin').split(',')

# retrieve ACLs for views if exist in configuration
try:
    acl = settings.items('acl')
except NoSectionError:
    acl = []


def get_ldap_connection():

    uri = settings.get('ldap', 'uri')
    conn = ldap.initialize(uri)

    # LDAP/SSL setup
    if uri.startswith('ldaps'):

        conn.protocol_version = ldap.VERSION3
        # Force cert validation
        conn.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)
Example #3
0
    }

    if settings.has_option("roles", "all"):
        all_s = settings.get("roles", "all")
        if all_s == "disabled":
            all_enabled = False
        elif not all_s == "enabled":
            print ("invalid value '%s' for all parameters, all role will be " "enabled." % (all_s))

    users = settings.get("roles", "user").split(",")
    admins = settings.get("roles", "admin").split(",")


# retrieve ACLs for views if exist in configuration
try:
    acl = settings.items("acl")
except NoSectionError:
    acl = []


def get_ldap_connection():

    uri = settings.get("ldap", "uri")
    conn = ldap.initialize(uri)

    # LDAP/SSL setup
    if uri.startswith("ldaps"):

        conn.protocol_version = ldap.VERSION3
        # Force cert validation
        conn.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)