Forum Discussion

Satish's avatar
Satish
New Contributor II
8 months ago

Is there a way to remove set of users from groups via xml(Load/Extract oprtion)

Hi,

Is there any way to remove users from the groups by using Load/Extract option from the system tab. i know we can add new groups or users but i want to remove the existing user from existing groups via xml.

Thank you in Advance, much appreciated for the help.

Thanks

Satish P 

  • Krishna's avatar
    Krishna
    Valued Contributor

    Satish  - It can be done using the extract and edit, save the XML file and load it into the OS.

     

  • Hi Krishna. We can also delete users and groups using Extender rules. 

  • HI Satish P

    You can delete users and groups using Extender rules. Try this rule below. Have fun :).

    Imports System
    Imports System.Data
    Imports System.Data.Common
    Imports System.IO
    Imports System.Collections.Generic
    Imports System.Globalization
    Imports System.Linq
    Imports Microsoft.VisualBasic
    Imports System.Windows.Forms
    Imports OneStream.Shared.Common
    Imports OneStream.Shared.Wcf
    Imports OneStream.Shared.Engine
    Imports OneStream.Shared.Database
    Imports OneStream.Stage.Engine
    Imports OneStream.Stage.Database
    Imports OneStream.Finance.Engine
    Imports OneStream.Finance.Database
     
    Namespace OneStream.BusinessRule.Extender.DeleteSecurityGroups
    Public Class MainClass
    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
    Try
    Select Case args.FunctionType
     
    Case Is = ExtenderFunctionType.Unknown
                    Dim secGroupsToDelete As New List(Of String)({"GroupA","GroupB","GroupC"}) 
    For Each secGroup As String In secGroupsToDelete
    BRApi.Security.Admin.DeleteGroup(si,secGroup)
    BRAPi.ErrorLog.LogMessage(si, "Security Group '" & secGroup & "' deleted by rule.")
    Next
    End Select
     
    Return Nothing
    Catch ex As Exception
    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try
    End Function
    End Class
    End Namespace
     
    Remeber - You tell the code what you want to delete by putting it in a Lookup transformation rule.
  • Henning's avatar
    Henning
    Valued Contributor II

    Hi, were you able to do this? If not, here is how it works, just as Krishna said.

    You can extract the XML file either with the option Krishna pointed out, or just extract directly to your local Downloads folder.

    You need to extract the security group(s) you wish to remove a user from. In my case, if I delete the entire row with "TEST_USER_2", save and load the file into the system, the user is no longer assigned to the security group "MySecurityGroup". With RegEx (Regular Expressions), search and replace in large files is saving you a lot of time.

    Of course, you can also use business rules to do this as cbriscoe pointed out as an alternative to doing this in the XML.