PortSight Secure Access Documentation

KB-SA-0011-I want to programmatically set the Read and Approve to Allow through some method call so how do I accomplish this?

 

Date:

September 1, 2004

 

Applies to:

Secure Access 2.1 and any later version

 

Summary:

I want to programmatically set the Read and Approve to Allow through some method call so how do I accomplish this?

 

Solution:

You can do that by calling ARResource.GrandAccess() and DenyAccess() methods, for details please refer to the Secure Access Classes Documentation.

 

Here is an example from the Guide:

 

Imports PortSight.SecureAccess.ARDataServices
Imports PortSight.SecureAccess.ARObjects

...

' This example shows how to grant the "Read" permission to the "PMs" group in the "WorkReports" application.

' connect to the Secure Access catalog
Dim arCN As New ARConnection()
arCN.ConnectToCatalog()

' get application object
Dim app As ARApplication = arCN.GetApplicationByAlias( "WorkReports")

' get ObjectID of the "PMs" group
Dim groupID As Integer = arCN.GetGroupByAlias( "PMs").ObjectID

' grant "Read" permission to the "PMs" group for the "WorkReports" application since tomorrow without time limit
app.GrantAccess(groupID, "WorkReports.Read", Now.AddDays(1))

' grant "Read" permission to the "PMs" group for the "WorkReports" application since tomorrow untill day after tomorrow
app.GrantAccess(groupID, "WorkReports.Read", Now.AddDays(1), Now.AddDays(2))

' remember to close the connection at the end!!!
arCN. Close()