Skip to main content
September 13, 2024

Determine Workflow Profile Security Access in a Dashboard Extender Rule

  • September 13, 2024
  • 3 replies
  • 0 views
I'm using the following code snippet in a Dashboard Extender Rule to loop through the list a of Workflow Profiles.  However, the code fails, if the user does not have security access to a particular Workflow Profile, returned in the list.  Is there a way I can get the list returned with security access applied, so the list only returns Workflow Profiles that the user has access to?
 
Dim profile As String = "text1 tag to match"
Dim wfProfileName As String = ""
Dim cubeRootInfo As WorkflowCubeRootInfo = BRApi.Workflow.Metadata.GetCubeRootInfo(si, si.WorkflowClusterPk.ProfileKey, True)
cubeRootCluster As New WorkflowUnitClusterPk(si.WorkflowClusterPk)
cubeRootCluster.ProfileKey = cubeRootInfo.CubeRootProfile.ProfileKey
Dim profileInfos As List(Of WorkflowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, cubeRootCluster, WorkflowProfileRelativeTypes.Descendants, WorkflowProfileTypes.BaseAndParentInputProfiles)
 
For Each profileInfo As WorkflowProfileInfo In profileInfos
Dim wfScenarioTypeID As Integer = BRApi.Workflow.General.GetScenarioTypeId(si, cubeRootCluster)
 
If profile = profileInfo.GetAttributeValue(WfScenarioTypeID,sharedconstants.WorkflowProfileAttributeIndexes.Text1)
wfProfileName = profileInfo.ToString
' brapi.ErrorLog.LogMessage(si," profileInfo.Name = " & profileInfo.ToString & " : Text1 = " & profileInfo.GetAttributeValue(WfScenarioTypeID,sharedconstants.WorkflowProfileAttributeIndexes.Text1))
End If
Next

 

3 replies

September 16, 2024

I do not believe there is a way to only return the profiles a user has access to. You would need to loop through the Profiles and bring in the AccessGroup and MaintenanceGroup IDs then check if the user is in that group using BRApi.Security.Authorization.IsUserInGroup(si, groupID). Before the loop create a new List (Of WorkflowProfileInfo) object and add the Workflow Profile Infos to it if the conditions are met.

October 4, 2024

I'm having a problem getting a list of all workflow profiles, to be able to loop through and pull Access Group and Maintenance Group.  Can you give me or direct me to a snippet of code that will return that list.

October 7, 2024

This function should help

BRApi.Workflow.Metadata.GetRelatives(si, cubeRootCluster, WorkflowProfileRelativeTypes.Descendants, WorkflowProfileTypes.BaseAndParentInputProfiles)

 

 

May 29, 2025

Have you tried the Method UserWorkflowProfilesRights? Create a data adapter like this:



These are the parameters:



 

June 8, 2025

Just surround the code inside your For loop with a Try/Catch/End Try ( https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/try-catch-finally-statement ), so that it will continue looping even if the code produces an error.

If you want to keep hold of the "good" profiles, create a list outside the loop, then inside the Try block (after all the other code) add the profile to the list; once the loop is over, your new list will only contain "good" profiles (because "bad" ones will have errored out before getting a chance to be added to the list).