The AcsClient object contains the following methods:
The AddGroupMember method adds a member to an ACS group.
AddGroupMember(GroupID As String, UserType As String, UserID As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
GroupID |
Yes |
The ID of the ACS group. |
|
UserType |
Yes |
The type of user specified in the UserID parameter. This value can be one of the following:
|
|
UserID |
Yes |
The ID of the user to be added to the group. |
Example
The following example adds a user named 'joe.bob' to the 'ADMINS' group:
|
Sub
Dim bRet bRet = AcsClient.AddGroupMember("ADMINS", "US", "joe.bob")
If (Not(bRet)) Then MsgBox "Failed to add group member" End If
End Sub |
The Connect method connects the object to a service.
Connect(DomainSiteService As String)
| Parameter | Required | Description |
|---|---|---|
|
DomainSiteService |
Yes |
The [Domain]Site.Service to which to connect. A domain is optional. The service must be a valid ACS. |
Returns 0 if successful and a non-zero value if the connection failed.
Example
The following example connects the AcsClient object to the CYGDEMO.ACS on domain 5410:
|
Sub AcsConnect() 'Connect to an ACS Dim AcsClient Set AcsClient = CreateObject("CxAcs.AcsClient") AcsClient.Connect("[5410]CYGDEMO.ACS") End Sub |
The DeleteGroupMember method deletes a member from an ACS group.
DeleteGroupMember(GroupID As String, UserID As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
GroupID |
Yes |
The ID of the ACS group. |
|
UserID |
Yes |
The ID of the user to be deleted from the group. |
Example
The following example deletes user 'joe.bob' from the 'ADMINS' group:
|
Sub
Dim bRet bRet = AcsClient.DeleteGroupMember("ADMINS", "joe.bob")
If (Not(bRet)) Then MsgBox "Failed to delete group member" End If
End Sub |
The Disconnect method disconnects from the service.
Disconnect()
Example
The following example disconnects the AcsClient object from the ACS:
|
Sub
AcsClient.Disconnect
End Sub |
The GetConsoleData method returns the console text and display attributes as two 25x80 arrays of unsigned characters.
GetConsoleData(ByRef pText, ByRef pAttr) As Integer
| Parameter | Required | Description |
|---|---|---|
|
pText |
Yes |
A two-dimensional 25x80 array of console text attributes returned by this method. |
|
pAttr |
Yes |
A two-dimensional 25x80 array of console display attributes returned by this method. |
This method returns 0 if successful.
Example
The following example writes the console text and display attributes to a CSV file.
|
Sub Dim aryText, aryAttr, nRet nRet = AcsClient.GetConsoleData(aryText, aryAttr)
' Write text attributes to CSV file Dim i, j, strMsg For i = 0 To UBound(aryText, 1) For j = 0 To UBound(aryText, 2) strMsg = strMsg + CStr(aryText(i, j)) + "," Next strMsg = strMsg + vbCr Next
dim fso, file Set fso = CreateObject("Scripting.FileSystemObject") Set file = fso.OpenTextFile("c:\console_text_attrs.csv", 2, True) file.WriteLine(strMsg) file.Close
strMsg = ""
' Write display attributes to CSV file For i = 0 To UBound(aryAttr, 1) For j = 0 To UBound(aryAttr, 2) strMsg = strMsg + CStr(aryAttr(i, j)) + "," Next strMsg = strMsg + vbCr Next
Set file = fso.OpenTextFile("c:\console_disp_attrs.csv", 2, True) file.WriteLine(strMsg) file.Close
MsgBox nRet End Sub |
The GetGroupMembersByType method retrieves all of the members of a specified type from an ACS group.
GetGroupMembersByType(GroupID As String, Type As String, UserList As Array) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
GroupID |
Yes |
The ID of the ACS group. |
|
Type |
Yes |
The type of members to be retrieved. This value can be one of the following:
|
|
UserList |
Yes |
The list of members returned. |
Example
The following example retrieves and displays all CygNet Group members in the 'ADMINS' group:
|
Sub
Dim membersList
Dim bRet bRet = AcsClient.GetGroupMembersByType("ADMINS", "CG", membersList)
Dim strMembers
Dim idx For idx = LBound(membersList) To UBound(membersList) strMembers = strMembers + membersList(idx) + vbCrLf Next
MsgBox strMembers
End Sub |
The GetReferences method refreshes the list of services referenced by the connected service. This method is a prerequisite for properties that reference other services, such as SystemLoggingService.
GetReferences()
Example
The following example gets the list of connected services and stores them locally:
|
Sub
AcsClient.GetReferences
End Sub |
The IsUserOk method checks if a user has sufficient access level for an app and event.
IsUserOk(App As String, Event As String, User As String, Access As String, UserOk As Boolean) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
App |
Yes |
The security application to check for access privilege. |
|
Event |
Yes |
The security event to check for access privilege. |
|
User |
Yes |
The ID of the user that will be checked for access. |
|
Access |
Yes |
The access level to check against the app and event:
|
|
UserOk |
Yes |
True if the user has sufficient access level for this app and event, otherwise false. |
Example
The following VBScript code example checks the "Read" access level of user "cygnet.user" for security app and event "DDS ODBC":
|
Function CheckIsUserOK(ByVal strACS_SS As String, ByVal strAPP As String, ByVal strEvent As String, ByVal strUser As String, ByVal strAccess As String) As Boolean
Dim objAcsClient As New CxAcsLib.AcsClient Dim blnPermStatus As Variant blnPermStatus = False
objAcsClient.Connect (strACS_SS) If objAcsClient.IsConnected Then
objAcsClient.IsUserOk strAPP, strEvent, strUser, strAccess, blnPermStatus objAcsClient.Disconnect
End If
Set objAcsClient = Nothing CheckIsUserOK = blnPermStatus
End Function
Sub CheckIsUserOK_Macro() Dim blnCheck As Boolean blnCheck = CheckIsUserOK("[12345]MYSITE.ACS", "DDS", "ODBC", "VSI\cygnet.user", "R") MsgBox (blnCheck) End Sub |
Note: To get the same query to work in VBA (for MS Access), change "Dim blnPermStatus As Variant" to "Dim blnPermStatus As Boolean".