05-06-2024 07:32 AM
Hi Team,
Is there any way to add/remove users/groups via business rule(dynamically).
i want to add user dynamically i.e not by clicking manually System---Security---Create user.
Thank you in Advance really appreciate.
05-06-2024 08:48 AM - edited 05-06-2024 08:52 AM
The BRApi.Security library has this functionality:
Here's an example to help get you started.
Re: I have a business rule question regarding interaction with security groups. - OneStream Communit...
05-06-2024 09:14 AM
Thank you so much for taking time RobbSalzmann for posting the above info, really appreciate.
i already got this info and were able to perform the activity.
05-06-2024 02:08 PM
@Satish - You can use the below code to delete the group
'Read the File
Dim FileReader As New System.IO.StreamReader(folderPath)
'Store the data
Dim stringReader As String = String.Empty
stringReader = FileReader.ReadLine()
'Read Each Line
For Each line As String In File.ReadLines(folderPath)
'Assign the Security GroupName from File to the String
Dim NewSecurityGroupName As String = line
Dim objGroupInfo1 As GroupInfo = BRApi.Security.Admin.GetGroup(si, NewSecurityGroupName)
If Not objGroupInfo1 Is Nothing Then
'Create a Object for Class Group
Dim objGroup As Group = New Group()
objGroup.Name = NewSecurityGroupName
'Create a Object for Class GroupInfo
Dim objGroupInfo As GroupInfo = New GroupInfo()
objGroupInfo.Group = objGroup
'Check the Group Already Exists
'BRApi.Security.Admin.SaveGroup(si, objGroupInfo, False, Nothing, TriStateBool.TrueValue)
BRApi.Security.Admin.DeleteGroup(si,NewSecurityGroupName)
BRApi.ErrorLog.LogMessage(si,NewSecurityGroupName & " " & "Group Deleted")
End If
Next
FileReader.Close()