How to add/remove users/groups via business rules.

Satish
New Contributor

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. 

 

3 REPLIES 3

RobbSalzmann
Valued Contributor

The BRApi.Security library has this functionality:

RobbSalzmann_0-1714999706233.png

Here's an example to help get you started.
Re: I have a business rule question regarding interaction with security groups. - OneStream Communit...

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.

Krishna
Valued Contributor

@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()
			
			
		

 

Thanks
Krishna