Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close()
- func (c *Client) Flags() (flags uint32)
- func (c *Client) Open(path string) (obj *Object, err error)
- func (c *Client) OpenComputer(path string) (computer *Computer, err error)
- func (c *Client) OpenComputerSC(path, user, password string, flags uint32) (computer *Computer, err error)
- func (c *Client) OpenContainer(path string) (container *Container, err error)
- func (c *Client) OpenContainerSC(path, user, password string, flags uint32) (container *Container, err error)
- func (c *Client) OpenDispatch(path string) (obj *ole.IDispatch, err error)
- func (c *Client) OpenDispatchSC(path, user, password string, flags uint32) (obj *ole.IDispatch, err error)
- func (c *Client) OpenInterface(path string, iid uuid.UUID) (obj *ole.IDispatch, err error)
- func (c *Client) OpenInterfaceSC(path, user, password string, flags uint32, iid uuid.UUID) (obj *ole.IDispatch, err error)
- func (c *Client) OpenSC(path, user, password string, flags uint32) (obj *Object, err error)
- func (c *Client) SetFlags(flags uint32)
- type Computer
- func (o *Computer) Attr(name string) (values []interface{}, err error)
- func (o *Computer) AttrBool(name string) (attr bool, err error)
- func (o *Computer) AttrBoolSlice(name string) (values []bool, err error)
- func (o *Computer) AttrBytes(name string) (attr []byte, err error)
- func (o *Computer) AttrBytesSlice(name string) (values [][]byte, err error)
- func (o *Computer) AttrGUID(name string) (attr uuid.UUID, err error)
- func (o *Computer) AttrGUIDSlice(name string) (values []uuid.UUID, err error)
- func (o *Computer) AttrInt(name string) (attr int, err error)
- func (o *Computer) AttrInt64(name string) (attr int64, err error)
- func (o *Computer) AttrInt64Slice(name string) (values []int64, err error)
- func (o *Computer) AttrIntSlice(name string) (values []int, err error)
- func (o *Computer) AttrString(name string) (attr string, err error)
- func (o *Computer) AttrStringSlice(name string) (values []string, err error)
- func (o *Computer) Class() (class string, err error)
- func (c *Computer) Close()
- func (o *Computer) GUID() (guid uuid.UUID, err error)
- func (c *Computer) ID() (id string, err error)
- func (o *Computer) Name() (name string, err error)
- func (c *Computer) OperatingSystem() (kind string, err error)
- func (o *Computer) Parent() (path string, err error)
- func (o *Computer) Path() (path string, err error)
- func (o *Computer) Pull(attrs ...string) (err error)
- func (o *Computer) Schema() (path string, err error)
- func (c *Computer) Site() (site string, err error)
- func (o *Computer) ToComputer() (c *Computer, err error)
- func (o *Computer) ToContainer() (c *Container, err error)
- func (o *Computer) ToGroup() (g *Group, err error)
- type Container
- func (c *Container) Children() (iter *ObjectIter, err error)
- func (c *Container) Close()
- func (c *Container) Container(class, name string) (container *Container, err error)
- func (c *Container) Filter() (filter []string, err error)
- func (c *Container) Object(class, name string) (obj *Object, err error)
- func (c *Container) SetFilter(filter ...string) (err error)
- func (c *Container) ToObject() (o *Object, err error)
- type Group
- func (o *Group) Attr(name string) (values []interface{}, err error)
- func (o *Group) AttrBool(name string) (attr bool, err error)
- func (o *Group) AttrBoolSlice(name string) (values []bool, err error)
- func (o *Group) AttrBytes(name string) (attr []byte, err error)
- func (o *Group) AttrBytesSlice(name string) (values [][]byte, err error)
- func (o *Group) AttrGUID(name string) (attr uuid.UUID, err error)
- func (o *Group) AttrGUIDSlice(name string) (values []uuid.UUID, err error)
- func (o *Group) AttrInt(name string) (attr int, err error)
- func (o *Group) AttrInt64(name string) (attr int64, err error)
- func (o *Group) AttrInt64Slice(name string) (values []int64, err error)
- func (o *Group) AttrIntSlice(name string) (values []int, err error)
- func (o *Group) AttrString(name string) (attr string, err error)
- func (o *Group) AttrStringSlice(name string) (values []string, err error)
- func (o *Group) Class() (class string, err error)
- func (g *Group) Close()
- func (g *Group) Description() (desc string, err error)
- func (o *Group) GUID() (guid uuid.UUID, err error)
- func (g *Group) Members() (m *Members, err error)
- func (o *Group) Name() (name string, err error)
- func (o *Group) Parent() (path string, err error)
- func (o *Group) Path() (path string, err error)
- func (o *Group) Pull(attrs ...string) (err error)
- func (o *Group) Schema() (path string, err error)
- func (o *Group) ToComputer() (c *Computer, err error)
- func (o *Group) ToContainer() (c *Container, err error)
- func (o *Group) ToGroup() (g *Group, err error)
- type Members
- type Object
- func (o *Object) Attr(name string) (values []interface{}, err error)
- func (o *Object) AttrBool(name string) (attr bool, err error)
- func (o *Object) AttrBoolSlice(name string) (values []bool, err error)
- func (o *Object) AttrBytes(name string) (attr []byte, err error)
- func (o *Object) AttrBytesSlice(name string) (values [][]byte, err error)
- func (o *Object) AttrGUID(name string) (attr uuid.UUID, err error)
- func (o *Object) AttrGUIDSlice(name string) (values []uuid.UUID, err error)
- func (o *Object) AttrInt(name string) (attr int, err error)
- func (o *Object) AttrInt64(name string) (attr int64, err error)
- func (o *Object) AttrInt64Slice(name string) (values []int64, err error)
- func (o *Object) AttrIntSlice(name string) (values []int, err error)
- func (o *Object) AttrString(name string) (attr string, err error)
- func (o *Object) AttrStringSlice(name string) (values []string, err error)
- func (o *Object) Class() (class string, err error)
- func (o *Object) Close()
- func (o *Object) GUID() (guid uuid.UUID, err error)
- func (o *Object) Name() (name string, err error)
- func (o *Object) Parent() (path string, err error)
- func (o *Object) Path() (path string, err error)
- func (o *Object) Pull(attrs ...string) (err error)
- func (o *Object) Schema() (path string, err error)
- func (o *Object) ToComputer() (c *Computer, err error)
- func (o *Object) ToContainer() (c *Container, err error)
- func (o *Object) ToGroup() (g *Group, err error)
- type ObjectIter
- type User
- func (o *User) Attr(name string) (values []interface{}, err error)
- func (o *User) AttrBool(name string) (attr bool, err error)
- func (o *User) AttrBoolSlice(name string) (values []bool, err error)
- func (o *User) AttrBytes(name string) (attr []byte, err error)
- func (o *User) AttrBytesSlice(name string) (values [][]byte, err error)
- func (o *User) AttrGUID(name string) (attr uuid.UUID, err error)
- func (o *User) AttrGUIDSlice(name string) (values []uuid.UUID, err error)
- func (o *User) AttrInt(name string) (attr int, err error)
- func (o *User) AttrInt64(name string) (attr int64, err error)
- func (o *User) AttrInt64Slice(name string) (values []int64, err error)
- func (o *User) AttrIntSlice(name string) (values []int, err error)
- func (o *User) AttrString(name string) (attr string, err error)
- func (o *User) AttrStringSlice(name string) (values []string, err error)
- func (o *User) Class() (class string, err error)
- func (u *User) Close()
- func (o *User) GUID() (guid uuid.UUID, err error)
- func (o *User) Name() (name string, err error)
- func (o *User) Parent() (path string, err error)
- func (o *User) Path() (path string, err error)
- func (o *User) Pull(attrs ...string) (err error)
- func (o *User) Schema() (path string, err error)
- func (o *User) ToComputer() (c *Computer, err error)
- func (o *User) ToContainer() (c *Container, err error)
- func (o *User) ToGroup() (g *Group, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClosed is returned from calls to a service or interface in the event // that the Close() function has already been called. ErrClosed = errors.New("interface is closing or already closed") // ErrNonDispatchVariant is returned when an attempt is made to cast an // ole.VARIANT to an ole.IDispatch type, but the VARIANT is of some other // This might happen, for example, when an iterator is interrogating the // members of an IEnumVARIANT in an attempt to convert them into an expected // type. ErrNonDispatchVariant = errors.New("object iterator unexpectedly yielded non-dispatch variant") // ErrInvalidGUID is returned when a given value cannot be interpreted as // a globally unique identifier. ErrInvalidGUID = errors.New("invalid GUID") // ErrNonArrayAttribute is returned when a given attribute cannot be converted // to a safe array. ErrNonArrayAttribute = errors.New("attribute is not an array") // ErrMultiDimArrayAttribute is returned when an attribute contains more than // one dimension in its array of values. ErrMultiDimArrayAttribute = errors.New("attribute contains a multi-dimensional array of values") // ErrNonVariantArrayAttribute is returned when the array members of a given // attribute are not variants. ErrNonVariantArrayAttribute = errors.New("attribute contains non-variant array members") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides access to Active Directory Service Interfaces for any namespace supported by a local or remote COM server.
func NewClient ¶
NewClient creates a new ADSI client. When done with a client it should be closed with a call to Close(). If NewClient is successful it will return a client and error will be nil, otherwise the returned client will be nil and error will be non-nil.
func NewRemoteClient ¶
NewRemoteClient creates a new ADSI client on a remote server. When done with a client it should be closed with a call to Close(). If NewClient is successful it will return a client and error will be nil, otherwise the returned client will be nil and error will be non-nil.
If no server is provided a local client is created instead and the resulting behavior is identical to NewClient.
func (*Client) Close ¶
func (c *Client) Close()
Close will release resources consumed by the client. It should be called when the client is no longer needed.
func (*Client) Open ¶
Open opens an ADSI object with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
Open returns the ADSI object as an Object type, which provides an idiomatic go wrapper around the underlying component object model IADs interface.
Open calls QueryInterface internally to acquire an implementation of the IADs interface that is needed by the Object type. If the returned directory object does not implement the IADs interface an error is returned.
The returned object consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned object when it is no longer needed.
func (*Client) OpenComputer ¶
OpenComputer opens an ADSI computer with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
OpenComputer returns the ADSI computer as a Computer type, which provides an idiomatic go wrapper around the underlying component object model IADsComputer interface.
OpenComputer calls QueryInterface internally to acquire an implementation of the IADsComputer interface that is needed by the Object type. If the returned directory object does not implement the IADsComputer interface an error is returned.
The returned computer consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned computer when it is no longer needed.
func (*Client) OpenComputerSC ¶
func (c *Client) OpenComputerSC(path, user, password string, flags uint32) (computer *Computer, err error)
OpenComputerSC opens an ADSI computer with the given path. When provided, the username and password are used to establish a security context for the connection. When credentials are not provided the existing security context of the application is used instead. The provided flags will be used when making the connection.
OpenComputerSC returns the ADSI computer as a Computer type, which provides an idiomatic go wrapper around the underlying component object model IADsComputer interface.
OpenComputerSC calls QueryInterface internally to acquire an implementation of the IADsComputer interface that is needed by the Object type. If the returned directory object does not implement the IADsComputer interface an error is returned.
The returned computer consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned computer when it is no longer needed.
func (*Client) OpenContainer ¶
OpenContainer opens an ADSI container with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
OpenContainer returns the ADSI container as a Container type, which provides an idiomatic go wrapper around the underlying component object model IADsContainer interface.
OpenContainer calls QueryInterface internally to acquire an implementation of the IADsContainer interface that is needed by the Object type. If the returned directory object does not implement the IADsContainer interface an error is returned.
The returned container consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned container when it is no longer needed.
func (*Client) OpenContainerSC ¶
func (c *Client) OpenContainerSC(path, user, password string, flags uint32) (container *Container, err error)
OpenContainerSC opens an ADSI container with the given path. When provided, the username and password are used to establish a security context for the connection. When credentials are not provided the existing security context of the application is used instead. The provided flags will be used when making the connection.
OpenContainerSC returns the ADSI container as a Container type, which provides an idiomatic go wrapper around the underlying component object model IADsContainer interface.
OpenContainerSC calls QueryInterface internally to acquire an implementation of the IADsContainer interface that is needed by the Object type. If the returned directory object does not implement the IADsContainer interface an error is returned.
The returned container consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned container when it is no longer needed.
func (*Client) OpenDispatch ¶
OpenDispatch opens an ADSI object with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
OpenDispatch returns a generic IDispatch interface for the object, which can be further interrogated to find out which component object model interfaces it implements.
To return an object that has already been wrapped in the more convenient and safer Object type, use Open instead.
To open an object with a specific interface ID, use OpenInterface instead.
The returned interface consumes resources until it is released. It is the caller's responsibilty to call Release on the returned object when it is no longer needed.
func (*Client) OpenDispatchSC ¶
func (c *Client) OpenDispatchSC(path, user, password string, flags uint32) (obj *ole.IDispatch, err error)
OpenDispatchSC opens an ADSI object with the given path. When provided, the username and password are used to establish a security context for the connection. When credentials are not provided the existing security context of the application is used instead. The provided flags will be used when making the connection.
OpenDispatchSC returns a generic IDispatch interface for the object, which can be further interrogated to find out which component object model interfaces it implements.
To return an object that has already been wrapped in the more convenient and safer Object type, use OpenSC instead.
To open an object with a specific interface ID, use OpenInterface instead.
The returned interface consumes resources until it is released. It is the caller's responsibilty to call Release on the returned object when it is no longer needed.
func (*Client) OpenInterface ¶
OpenInterface opens a directory object with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
OpenInterface calls QueryInterface internally to return a pointer to an object implementing the requested interface ID. If the returned object does not implement the requested interface an error is returned. The object is returned as a pointer to an IDispatch interface; it is expected that the caller will recast it as a pointer to the requested implementation.
To return an object that has already been wrapped in the more convenient and safer Object type, use OpenObject instead.
The returned interface consumes resources until it is released. It is the caller's responsibilty to call Release on the returned object when it is no longer needed.
func (*Client) OpenInterfaceSC ¶
func (c *Client) OpenInterfaceSC(path, user, password string, flags uint32, iid uuid.UUID) (obj *ole.IDispatch, err error)
OpenInterfaceSC opens a directory object with the given path. When provided, the username and password are used to establish a security context for the connection. When credentials are not provided the existing security context of the application is used instead. The provided flags will be used when making the connection.
OpenInterfaceSC calls QueryInterface internally to return a pointer to an object implementing the requested interface ID. If the returned object does not implement the requested interface an error is returned. The object is returned as a pointer to an IDispatch interface; it is expected that the caller will recast it as a pointer to the requested implementation.
To return an object that has already been wrapped in the more convenient and safer Object type, use OpenObject instead.
The returned interface consumes resources until it is released. It is the caller's responsibilty to call Release on the returned object when it is no longer needed.
func (*Client) OpenSC ¶
OpenSC opens an ADSI object with the given path. When provided, the username and password are used to establish a security context for the connection. When credentials are not provided the existing security context of the application is used instead. The provided flags will be used when making the connection.
OpenSC returns the ADSI object as an Object type, which provides an idiomatic go wrapper around the underlying component object model IADs interface.
OpenSC calls QueryInterface internally to acquire an implementation of the IADs interface that is needed by the Object type. If the returned directory object does not implement the IADs interface an error is returned.
The returned object consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned object when it is no longer needed.
type Computer ¶
type Computer struct {
// contains filtered or unexported fields
}
Computer provides access to Active Directory computers.
func NewComputer ¶
func NewComputer(iface *api.IADsComputer) *Computer
NewComputer returns a computer that manages the given COM interface.
func OpenComputer ¶
OpenComputer opens an ADSI computer with the given path. The existing security context of the application and any flags specified via SetFlags will be used when making the connection. The default flags specify an encrypted read-only connection.
OpenComputer returns the ADSI computer as a Computer type, which provides an idiomatic go wrapper around the underlying component object model IADsComputer interface.
If the returned directory object does not implement the IADsComputer interface an error is returned.
The returned computer consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned computer when it is no longer needed.
func OpenComputerSC ¶
OpenComputerSC opens an ADSI computer with the given path. Most users will use OpenComputer instead. It creates an ephemeral local client and uses it to open the requested computer.
When provided, the username and password are used to establish a security context for the connection. When they are not provided the existing security context of the application is used instead. The provided flags will be used to make the connection.
OpenComputerSC returns the ADSI computer as a Computer type, which provides an idiomatic go wrapper around the underlying component object model IADsComputer interface.
If the returned directory object does not implement the IADsComputer interface an error is returned.
The returned computer consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned computer when it is no longer needed.
func (*Computer) Attr ¶
Attr attempts to retrieve the attribute with the given name and return its values as a slice of interfaces. Each value is an interface{} that holds a Go native type that is the best match for the underlying variant.
If the attribute contains IUnknown or IDispatch members, it is the caller's responsibility to release them.
func (*Computer) AttrBool ¶
AttrBool attempts to retrieve the attribute with the given name and return its value as a bool. If the attribute holds more than one value, only the first value is returned.
Any non-bool values contained in the attribute will be ignored.
func (*Computer) AttrBoolSlice ¶
AttrBoolSlice attempts to retrieve the attribute with the given name and return its values as a slice of bools.
Any non-bool values contained in the attribute will be ommitted.
func (*Computer) AttrBytes ¶
AttrBytes attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Computer) AttrBytesSlice ¶
AttrBytesSlice attempts to retrieve the attribute with the given name and return its values as a slice of byte slices.
Any non-byte values contained in the attribute will be ommitted.
func (*Computer) AttrGUID ¶
AttrGUID attempts to retrieve the attribute with the given name and return its value as a GUID in string format. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Computer) AttrGUIDSlice ¶
AttrGUIDSlice attempts to retrieve the attribute with the given name and return its values as a slice of GUIDs.
Any non-GUID values contained in the attribute will be ommitted.
Values are returned as-is, without any byte ordering adjustment.
func (*Computer) AttrInt ¶
AttrInt attempts to retrieve the attribute with the given name and return its value as an integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Computer) AttrInt64 ¶
AttrInt64 attempts to retrieve the attribute with the given name and return its value as a 64-bit integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Computer) AttrInt64Slice ¶
AttrInt64Slice attempts to retrieve the attribute with the given name and return its values as a slice of 64-bit integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
func (*Computer) AttrIntSlice ¶
AttrIntSlice attempts to retrieve the attribute with the given name and return its values as a slice of integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
64-bit integer types will be coerced into integer types, which may overflow the value on 32-bit systems.
func (*Computer) AttrString ¶
AttrString attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Computer) AttrStringSlice ¶
AttrStringSlice attempts to retrieve the attribute with the given name and return its values as a slice of strings.
Any non-string values contained in the attribute will be ommitted.
func (*Computer) Close ¶
func (c *Computer) Close()
Close will release resources consumed by the computer. It should be called when the computer is no longer needed.
func (*Computer) OperatingSystem ¶
OperatingSystem retrieves the operating system of the computer.
func (*Computer) Pull ¶
Pull causes the given list of attributes to be retrieved from the underlying LDAP data store. The retrieved attributes will be cached.
Subsequent calls to the attr retrieval functions will return the cached values.
func (*Computer) Schema ¶
Schema retrieves the fully qualified path of the object's schema class object.
func (*Computer) ToComputer ¶
ToComputer attempts to acquire a computer interface for the object.
func (*Computer) ToContainer ¶
ToContainer attempts to acquire a container interface for the object.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container provides access to Active Directory container objects.
func NewContainer ¶
func NewContainer(iface *api.IADsContainer) *Container
NewContainer returns a container that manages the given COM interface.
func OpenContainer ¶
OpenContainer opens an ADSI container with the given path. It creates an ephemeral local client and uses it to open the requested container. The connection is made using the security context of the application and the default client flags specifying that it be encrypted and read-only.
OpenContainer returns the ADSI container as a Container type, which provides an idiomatic go wrapper around the underlying component object model IADsContainer interface.
If the returned directory object does not implement the IADsContainer interface an error is returned.
The returned container consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned container when it is no longer needed.
func OpenContainerSC ¶
OpenContainerSC opens an ADSI container with the given path. Most users will use OpenContainer instead. It creates an ephemeral local client and uses it to open the requested container.
When provided, the username and password are used to establish a security context for the connection. When they are not provided the existing security context of the application is used instead. The provided flags will be used to make the connection.
OpenContainerSC returns the ADSI container as a Container type, which provides an idiomatic go wrapper around the underlying component object model IADsContainer interface.
If the returned directory object does not implement the IADsContainer interface an error is returned.
The returned container consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned container when it is no longer needed.
func (*Container) Children ¶
func (c *Container) Children() (iter *ObjectIter, err error)
Children returns an object iterator that provides access to the immediate children of the container.
func (*Container) Close ¶
func (c *Container) Close()
Close will release resources consumed by the container. It should be called when the container is no longer needed.
func (*Container) Container ¶
Container returns a descendant container with the given class and relative name.
If a class is not provided then the first item matching the relative name will be returned regardless of its class.
func (*Container) Object ¶
Object returns a descendant object with the given class and relative name.
If a class is not provided then the first item matching the relative name will be returned regardless of its class.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group provides access to Active Directory groups.
func (*Group) Attr ¶
Attr attempts to retrieve the attribute with the given name and return its values as a slice of interfaces. Each value is an interface{} that holds a Go native type that is the best match for the underlying variant.
If the attribute contains IUnknown or IDispatch members, it is the caller's responsibility to release them.
func (*Group) AttrBool ¶
AttrBool attempts to retrieve the attribute with the given name and return its value as a bool. If the attribute holds more than one value, only the first value is returned.
Any non-bool values contained in the attribute will be ignored.
func (*Group) AttrBoolSlice ¶
AttrBoolSlice attempts to retrieve the attribute with the given name and return its values as a slice of bools.
Any non-bool values contained in the attribute will be ommitted.
func (*Group) AttrBytes ¶
AttrBytes attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Group) AttrBytesSlice ¶
AttrBytesSlice attempts to retrieve the attribute with the given name and return its values as a slice of byte slices.
Any non-byte values contained in the attribute will be ommitted.
func (*Group) AttrGUID ¶
AttrGUID attempts to retrieve the attribute with the given name and return its value as a GUID in string format. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Group) AttrGUIDSlice ¶
AttrGUIDSlice attempts to retrieve the attribute with the given name and return its values as a slice of GUIDs.
Any non-GUID values contained in the attribute will be ommitted.
Values are returned as-is, without any byte ordering adjustment.
func (*Group) AttrInt ¶
AttrInt attempts to retrieve the attribute with the given name and return its value as an integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Group) AttrInt64 ¶
AttrInt64 attempts to retrieve the attribute with the given name and return its value as a 64-bit integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Group) AttrInt64Slice ¶
AttrInt64Slice attempts to retrieve the attribute with the given name and return its values as a slice of 64-bit integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
func (*Group) AttrIntSlice ¶
AttrIntSlice attempts to retrieve the attribute with the given name and return its values as a slice of integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
64-bit integer types will be coerced into integer types, which may overflow the value on 32-bit systems.
func (*Group) AttrString ¶
AttrString attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Group) AttrStringSlice ¶
AttrStringSlice attempts to retrieve the attribute with the given name and return its values as a slice of strings.
Any non-string values contained in the attribute will be ommitted.
func (*Group) Close ¶
func (g *Group) Close()
Close will release resources consumed by the group. It should be called when the group is no longer needed.
func (*Group) Description ¶
Description retrieves the description of the group.
func (*Group) Members ¶
Members returns a membership that provides access to the members of the group.
func (*Group) Pull ¶
Pull causes the given list of attributes to be retrieved from the underlying LDAP data store. The retrieved attributes will be cached.
Subsequent calls to the attr retrieval functions will return the cached values.
func (*Group) Schema ¶
Schema retrieves the fully qualified path of the object's schema class object.
func (*Group) ToComputer ¶
ToComputer attempts to acquire a computer interface for the object.
func (*Group) ToContainer ¶
ToContainer attempts to acquire a container interface for the object.
type Members ¶
type Members struct {
// contains filtered or unexported fields
}
Members provides access to group membership.
func NewMembers ¶
func NewMembers(iface *api.IADsMembers) *Members
NewMembers returns a membership that manages the given COM interface.
func (*Members) Close ¶
func (m *Members) Close()
Close will release resources consumed by the membership. It should be called when the membership is no longer needed.
func (*Members) Iter ¶
func (m *Members) Iter() (iter *ObjectIter, err error)
Iter returns an object iterator that provides access to the members of the group.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object provides access to Active Directory objects.
func Open ¶
Open opens an ADSI object with the given path. It creates an ephemeral local client and uses it to open the requested object. The connection is made using the security context of the application and the default client flags specifying that it be encrypted and read-only.
Open returns the ADSI object as an Object type, which provides an idiomatic go wrapper around the underlying component object model IADs interface.
If the requested ADSI object does not implement the IADs interface an error is returned.
The returned object consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned object when it is no longer needed.
func OpenSC ¶
OpenSC opens an ADSI object with the given path. Most users will use Open instead. It creates an ephemeral local client and uses it to open the requested object.
When provided, the username and password are used to establish a security context for the connection. When they are not provided the existing security context of the application is used instead. The provided flags will be used to make the connection.
OpenSC returns the ADSI object as an Object type, which provides an idiomatic go wrapper around the underlying component object model IADs interface.
If the requested ADSI object does not implement the IADs interface an error is returned.
The returned object consumes resources until it is closed. It is the caller's responsibilty to call Close on the returned object when it is no longer needed.
func (*Object) Attr ¶
Attr attempts to retrieve the attribute with the given name and return its values as a slice of interfaces. Each value is an interface{} that holds a Go native type that is the best match for the underlying variant.
If the attribute contains IUnknown or IDispatch members, it is the caller's responsibility to release them.
func (*Object) AttrBool ¶
AttrBool attempts to retrieve the attribute with the given name and return its value as a bool. If the attribute holds more than one value, only the first value is returned.
Any non-bool values contained in the attribute will be ignored.
func (*Object) AttrBoolSlice ¶
AttrBoolSlice attempts to retrieve the attribute with the given name and return its values as a slice of bools.
Any non-bool values contained in the attribute will be ommitted.
func (*Object) AttrBytes ¶
AttrBytes attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Object) AttrBytesSlice ¶
AttrBytesSlice attempts to retrieve the attribute with the given name and return its values as a slice of byte slices.
Any non-byte values contained in the attribute will be ommitted.
func (*Object) AttrGUID ¶
AttrGUID attempts to retrieve the attribute with the given name and return its value as a GUID in string format. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Object) AttrGUIDSlice ¶
AttrGUIDSlice attempts to retrieve the attribute with the given name and return its values as a slice of GUIDs.
Any non-GUID values contained in the attribute will be ommitted.
Values are returned as-is, without any byte ordering adjustment.
func (*Object) AttrInt ¶
AttrInt attempts to retrieve the attribute with the given name and return its value as an integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Object) AttrInt64 ¶
AttrInt64 attempts to retrieve the attribute with the given name and return its value as a 64-bit integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*Object) AttrInt64Slice ¶
AttrInt64Slice attempts to retrieve the attribute with the given name and return its values as a slice of 64-bit integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
func (*Object) AttrIntSlice ¶
AttrIntSlice attempts to retrieve the attribute with the given name and return its values as a slice of integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
64-bit integer types will be coerced into integer types, which may overflow the value on 32-bit systems.
func (*Object) AttrString ¶
AttrString attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*Object) AttrStringSlice ¶
AttrStringSlice attempts to retrieve the attribute with the given name and return its values as a slice of strings.
Any non-string values contained in the attribute will be ommitted.
func (*Object) Close ¶
func (o *Object) Close()
Close will release resources consumed by the object. It should be called when the object is no longer needed.
func (*Object) Pull ¶
Pull causes the given list of attributes to be retrieved from the underlying LDAP data store. The retrieved attributes will be cached.
Subsequent calls to the attr retrieval functions will return the cached values.
func (*Object) Schema ¶
Schema retrieves the fully qualified path of the object's schema class object.
func (*Object) ToComputer ¶
ToComputer attempts to acquire a computer interface for the object.
func (*Object) ToContainer ¶
ToContainer attempts to acquire a container interface for the object.
type ObjectIter ¶
type ObjectIter struct {
// contains filtered or unexported fields
}
ObjectIter provides an iterator for a set of objects.
func NewObjectIter ¶
func NewObjectIter(enumerator *ole.IEnumVARIANT) *ObjectIter
NewObjectIter returns an object iterator that provides access to the objects contained in the given enumerator.
func (*ObjectIter) Close ¶
func (iter *ObjectIter) Close()
Close will release resources consumed by the iterator. It should be called when the iterator is no longer needed.
func (*ObjectIter) Next ¶
func (iter *ObjectIter) Next() (obj *Object, err error)
Next moves the iterator to the next object and returns a pointer to it. If it has reached the end of the set it will return io.EOF. It the iterator has already been closed it will return ErrClosed.
FIXME: Make sure that io.EOF is being returned as expected. We might have to intercept an internal error.
type User ¶
type User struct {
// contains filtered or unexported fields
}
User provides access to Active Directory users.
func (*User) Attr ¶
Attr attempts to retrieve the attribute with the given name and return its values as a slice of interfaces. Each value is an interface{} that holds a Go native type that is the best match for the underlying variant.
If the attribute contains IUnknown or IDispatch members, it is the caller's responsibility to release them.
func (*User) AttrBool ¶
AttrBool attempts to retrieve the attribute with the given name and return its value as a bool. If the attribute holds more than one value, only the first value is returned.
Any non-bool values contained in the attribute will be ignored.
func (*User) AttrBoolSlice ¶
AttrBoolSlice attempts to retrieve the attribute with the given name and return its values as a slice of bools.
Any non-bool values contained in the attribute will be ommitted.
func (*User) AttrBytes ¶
AttrBytes attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*User) AttrBytesSlice ¶
AttrBytesSlice attempts to retrieve the attribute with the given name and return its values as a slice of byte slices.
Any non-byte values contained in the attribute will be ommitted.
func (*User) AttrGUID ¶
AttrGUID attempts to retrieve the attribute with the given name and return its value as a GUID in string format. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*User) AttrGUIDSlice ¶
AttrGUIDSlice attempts to retrieve the attribute with the given name and return its values as a slice of GUIDs.
Any non-GUID values contained in the attribute will be ommitted.
Values are returned as-is, without any byte ordering adjustment.
func (*User) AttrInt ¶
AttrInt attempts to retrieve the attribute with the given name and return its value as an integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*User) AttrInt64 ¶
AttrInt64 attempts to retrieve the attribute with the given name and return its value as a 64-bit integer. If the attribute holds more than one value, only the first value is returned.
Any non-integer values contained in the attribute will be ignored.
func (*User) AttrInt64Slice ¶
AttrInt64Slice attempts to retrieve the attribute with the given name and return its values as a slice of 64-bit integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
func (*User) AttrIntSlice ¶
AttrIntSlice attempts to retrieve the attribute with the given name and return its values as a slice of integers.
Any non-integer values contained in the attribute will be ommitted.
Unsigned integer values will be coerced into signed types.
64-bit integer types will be coerced into integer types, which may overflow the value on 32-bit systems.
func (*User) AttrString ¶
AttrString attempts to retrieve the attribute with the given name and return its value as a string. If the attribute holds more than one value, only the first value is returned.
Any non-string values contained in the attribute will be ignored.
func (*User) AttrStringSlice ¶
AttrStringSlice attempts to retrieve the attribute with the given name and return its values as a slice of strings.
Any non-string values contained in the attribute will be ommitted.
func (*User) Close ¶
func (u *User) Close()
Close will release resources consumed by the user. It should be called when the user is no longer needed.
func (*User) Pull ¶
Pull causes the given list of attributes to be retrieved from the underlying LDAP data store. The retrieved attributes will be cached.
Subsequent calls to the attr retrieval functions will return the cached values.
func (*User) Schema ¶
Schema retrieves the fully qualified path of the object's schema class object.
func (*User) ToComputer ¶
ToComputer attempts to acquire a computer interface for the object.
func (*User) ToContainer ¶
ToContainer attempts to acquire a container interface for the object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package comclsid provides component object model class identifiers for active directory domain services.
|
Package comclsid provides component object model class identifiers for active directory domain services. |
Package comiid provides component object model interface identifiers for active directory domain services.
|
Package comiid provides component object model interface identifiers for active directory domain services. |