Quantcast
Channel: Software Communities : Popular Discussions - Dell One Identity Manager
Viewing all articles
Browse latest Browse all 845

Script-based creation of user account resource

$
0
0

Hi Community, long time no see...

 

I've got a question for you which is resulting based upon my "weird" scenario:

 

Our customer does have a bunch of systems that are managed manually but they do want to reconcile the data with Q1IM based upon CSV files. So we implemented an import that is mapping user accounts, entitlements and entitlement assignements into the UNS namespace leveraging one UNSRoot per manual system. So far, so good. Now the challenge is: if a new manual system does appear in the import file, we'd like to create a new UNSRoot for that new manual system, stuffed with an user accounts resource that is available through IT Shop.

 

Now here's the issue: when creating the user account resource, we're getting the following error message:

Detailed Error Message: Resources: Write permission denied for value "Path".

 

This is the script code which we built to create the UNS Root including the user account resource:

 

''' <summary>

        ''' Procedure to handle the resource of an manual resource import

        ''' </summary>

        ''' <param name="Resource">Teh resource to be handled</param>

        ''' <param name="Log">the log file</param>

        ''' <remarks></remarks>

        Private Sub XXX_Import_ManualResources_HandleResource(ByVal Resource As String, ByVal Log As String)

            Dim UNSRoot As ISingleDbObject = Nothing

            Dim f As ISqlFormatter = Connection.SqlFormatter

            Dim AccountResource As ISingleDbObject = Nothing

            Dim AccProduct As ISingleDbObject = Nothing

            Dim AccProductGroup As ISingleDbObject = Nothing

            Dim ITShopOrg As ISingleDbObject = Nothing

            Dim ITShopOrgHasResource As ISingleDbObject = Nothing

 

            Try

                'check existence of UNSRoot

                If Not Connection.Exists("UNSRoot", f.AndRelation(f.Comparison("Ident_UNSRoot", Resource, ValType.String, CompareOperator.Equal), f.Comparison("XXX_IsManualResource", True, ValType.Bool, CompareOperator.Equal))) Then

                    'create new UNSRoot for Resource

                    VID_Write2Log(Log, String.Format("Detected new resource {0}.", Resource))

                    UNSRoot = Connection.CreateSingle("UNSRoot")

                    UNSRoot.PutValue("Ident_UNSRoot", Resource)

                    UNSRoot.PutValue("DisplayName", Resource)

                    UNSRoot.PutValue("XXX_IsManualResource", True)

                    UNSRoot.PutValue("Description", "Automatically created by manual resource reconciliation")

                    'UNSRoot.Save()

                    'VID_Write2Log(Log, String.Format("Resource {0} created", Resource))

 

                    'create user account resource

                    AccountResource = Connection.CreateSingle("Ressource")

                    AccountResource.PutValue("Ident_Ressource", String.Format("Resource Access {0}", Resource))

                    AccountResource.PutValue("IsAccountRessource", True)

                    AccountResource.PutValue("ConnectionPath", Resource)

                    AccountResource.PutValue("ConnectionTable", "UNSAccount")

                    AccountResource.PutValue("DefaultManageLevel", "1")

 

                    'create AccProduct

                    AccProduct = Connection.CreateSingle("AccProduct")

                    AccProduct.PutValue("Ident_AccProduct", String.Format("Resource Access {0}", Resource))

 

                    'create Service Category

                    If Not Connection.Exists("AccProductGroup", f.AndRelation(f.Comparison("Ident_AccProductGroup", Resource, ValType.String, CompareOperator.Equal), f.Comparison("UID_AccProductGroupParent", Connection.GetSingleProperty("AccProductGroup", "UID_AccProductGroup", f.Comparison("Ident_AccProductGroup", "Manual Resources", ValType.String, CompareOperator.Equal)), ValType.String, CompareOperator.Equal))) Then

                        AccProductGroup = Connection.CreateSingle("AccProductGroup")

                        AccProductGroup.PutValue("Ident_AccProductGroup", Resource)

                        AccProductGroup.PutValue("UID_AccProductGroupParent", Connection.GetSingleProperty("AccProductGroup", "UID_AccProductGroup", f.Comparison("Ident_AccProductGroup", "Manual Resources", ValType.String, CompareOperator.Equal)))

                        AccProduct.Save()

                        'map AccProduct into ProductGroup

                        AccProduct.PutValue("UID_AccProductGroup", AccProductGroup.GetValue("UID_AccProductGroup"))

                    Else

                        AccProduct.PutValue("UID_AccProductGroup", Connection.GetSingleProperty("AccProductGroup", "UID_AccProductGroup", f.AndRelation(f.Comparison("Ident_AccProductGroup", Resource, ValType.String, CompareOperator.Equal), f.Comparison("UID_AccProductGroupParent", Connection.GetSingleProperty("AccProductGroup", "UID_AccProductGroup", f.Comparison("Ident_AccProductGroup", "Manual Resources", ValType.String, CompareOperator.Equal)), ValType.String, CompareOperator.Equal))))

                    End If

 

                    'save AccProduct

                    AccProduct.Save()

 

                    AccountResource.PutValue("UID_AccProduct", AccProduct.GetValue("UID_AccProduct"))

                    AccountResource.PutValue("IsForITShop", True)

                    AccountResource.Save()

 

                    'save UNSRoot with AccountResource

                    UNSRoot.PutValue("UID_AccountRessource", AccountResource.GetValue("UID_Ressource"))

                    UNSRoot.Save()

                    VID_Write2Log(Log, String.Format("Resource {0} created", Resource))

 

                    'create Shop

                    If Not Connection.Exists("ITShopOrg", f.AndRelation(f.Comparison("ITShopInfo", "BO", ValType.String, CompareOperator.Equal), f.Comparison("Ident_Org", Resource, ValType.String, CompareOperator.Equal), f.Comparison("UID_ParentITShopOrg", Connection.GetSingleProperty("ITShopOrg", "UID_ITShopOrg", f.AndRelation(f.Comparison("Ident_ITShopOrg", "XXX", ValType.String, CompareOperator.Equal), f.Comparison("ITShopInfo", "SH", ValType.String, CompareOperator.Equal))), ValType.String, CompareOperator.Equal))) Then

                        ITShopOrg = Connection.CreateSingle("ITShopOrg")

                        ITShopOrg.PutValue("Ident_Org", Resource)

                        ITShopOrg.PutValue("ITShopInfo", "BO")

                        ITShopOrg.PutValue("UID_ParentITShopOrg", Connection.GetSingleProperty("ITShopOrg", "UID_ITShopOrg", f.AndRelation(f.Comparison("Ident_ITShopOrg", "XXX", ValType.String, CompareOperator.Equal), f.Comparison("ITShopInfo", "SH", ValType.String, CompareOperator.Equal))))

                        ITShopOrg.Save()

                        'put resource in shop

                        ITShopOrgHasResource = Connection.CreateSingle("ITShopOrgHasRessource")

                        ITShopOrgHasResource.PutValue("UID_ITShopOrg", ITShopOrg.GetValue("UID_ITShopOrg"))

                        ITShopOrgHasResource.PutValue("UID_Ressource", AccountResource.GetValue("UID_Ressource"))

                        ITShopOrgHasResource.Save()

                    Else

                        'put resource in Shop

                        ITShopOrgHasResource = Connection.CreateSingle("ITShopOrgHasRessource")

                        ITShopOrgHasResource.PutValue("UID_ITShopOrg", Connection.GetSingleProperty("ITShopOrg", "UID_ITShopOrg", f.AndRelation(f.Comparison("ITShopInfo", "BO", ValType.String, CompareOperator.Equal), f.Comparison("Ident_Org", Resource, ValType.String, CompareOperator.Equal), f.Comparison("UID_ParentITShopOrg", Connection.GetSingleProperty("ITShopOrg", "UID_ITShopOrg", f.AndRelation(f.Comparison("Ident_ITShopOrg", "XXX", ValType.String, CompareOperator.Equal), f.Comparison("ITShopInfo", "SH", ValType.String, CompareOperator.Equal))), ValType.String, CompareOperator.Equal))))

                        ITShopOrgHasResource.PutValue("UID_Ressource", AccountResource.GetValue("UID_Ressource"))

                        ITShopOrgHasResource.Save()

                    End If

                End If

            Catch ex As Exception

                Throw ex

            Finally

                'freeing up memory resources

                UNSRoot = Nothing

                f = Nothing

                AccountResource = Nothing

                ITShopOrg = Nothing

                ITShopOrgHasResource = Nothing

                AccProduct = Nothing

                AccProductGroup = Nothing

            End Try

        End Sub

 

I just replaced our customer prefix using XXX.

 

So what would be the best way to create a user account resource script based without experiencing error messages when setting the connection path and connection table?

 

Thanks

Carsten


Viewing all articles
Browse latest Browse all 845

Trending Articles