Class List Method List File List

# Module: Yast::LdapRoutinesInclude

Defined in:
  ../../src/include/ldap/routines.rb

## Instance Method Summary (collapse)

- - (Object) get_cn(dn)

  Get first value from dn (don't have to be “cn”).

- - (Object) get_dn(cn)

  Create DN from cn by adding base config DN (Can't work in general cases!).

- - (Object) get_new_dn(cn, dn)

  Create new DN from DN by changing leading cn value (Can't work in general cases!).

- - (Object) get_rdn(dn)

  Get RDN (relative distinguished name) from dn.

- - (Object) get_string(object, attr)

  Get string value of attribute from map.

- - (Object) initialize_ldap_routines(include_target)

## Instance Method Details

### - (`Object`) get_cn(dn)

Get first value from dn (don't have to be “cn”)

    44
    45
    46
    47
    48
    49
    # File '../../src/include/ldap/routines.rb', line 44

    def get_cn(dn)
      rdn = get_rdn(dn)
      Builtins.issubstring(rdn, "=") ?
        Builtins.substring(rdn, Ops.add(Builtins.search(rdn, "="), 1)) :
        rdn
    end

### - (`Object`) get_dn(cn)

Create DN from cn by adding base config DN (Can't work in general cases!)

    53
    54
    55
    # File '../../src/include/ldap/routines.rb', line 53

    def get_dn(cn)
      Builtins.sformat("cn=%1,%2", cn, Ldap.base_config_dn)
    end

### - (`Object`) get_new_dn(cn, dn)

Create new DN from DN by changing leading cn value (Can't work in general cases!)

    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    # File '../../src/include/ldap/routines.rb', line 59

    def get_new_dn(cn, dn)
      Builtins.tolower(
        Builtins.sformat(
          "cn=%1%2",
          cn,
          Builtins.issubstring(dn, ",") ?
            Builtins.substring(dn, Builtins.search(dn, ",")) :
            ""
        )
      )
    end

### - (`Object`) get_rdn(dn)

Get RDN (relative distinguished name) from dn

    38
    39
    40
    41
    # File '../../src/include/ldap/routines.rb', line 38

    def get_rdn(dn)
      dn_list = Builtins.splitstring(dn, ",")
      Ops.get_string(dn_list, 0, dn)
    end

### - (`Object`) get_string(object, attr)

Get string value of attribute from map. (Generaly, it is supposed to be list or string.)

    73
    74
    75
    76
    77
    78
    79
    # File '../../src/include/ldap/routines.rb', line 73

    def get_string(object, attr)
      object = deep_copy(object)
      if Ops.is_list?(Ops.get(object, attr))
        return Ops.get_string(object, [attr, 0], "")
      end
      Ops.get_string(object, attr, "")
    end

### - (`Object`) initialize_ldap_routines(include_target)

    31
    32
    33
    34
    35
    # File '../../src/include/ldap/routines.rb', line 31

    def initialize_ldap_routines(include_target)
      textdomain "ldap-client"

      Yast.import "Ldap"
    end