The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
smarshall2
22 days agoNew Contributor II
List of User Default Home Pages
Hi Folks,
Wondering if anyone has built a BR or query to compile a list of Users and their Default Home Page.
I know its in the UserAppSettings.xml File within File Explorer under Internal/User, and you can set individuals through the Admin Solution Tools, however I have not found a good way to See what is already set without going to each user individually (that would not be very practical).
Appreciate any help!
Stephanie
3 Replies
- JJones
OneStream Employee
Attached is a business rule for you that would perform this for you:
- Retrieves all users from the OneStream security store
- For each user loads their full UserInfo object for the display name
- Reads their UserAppSettings.xml from the Internal File System via FileSystemLocation.ApplicationDatabase
- Parses the SilverlightHomePageUrl element and intelligently extracts just the dashboard name by skipping known keywords like Dashboard:False, Default, True, False, and Unknown
- Outputs everything to a clean sortable grid
I created this as a Dashboard Data Set rule, so you could attach it to a data adapter as a method query and then assign it to a grid component and then export out the contents from the grid.
- JJones
OneStream Employee
Imports System Imports System.Collections.Generic Imports System.Data Imports System.Data.Common Imports System.Globalization Imports System.IO Imports System.Linq Imports Microsoft.VisualBasic Imports OneStream.Finance.Database Imports OneStream.Finance.Engine Imports OneStream.Shared.Common Imports OneStream.Shared.Database Imports OneStream.Shared.Engine Imports OneStream.Shared.Wcf Imports OneStream.Stage.Database Imports OneStream.Stage.Engine Imports OneStream.Data.DataFrame Imports OneStream.Data.DataFrame.Abstractions Namespace OneStream.BusinessRule.DashboardDataSet.UserHomePageExport Public Class MainClass Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, _ ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object Try ' Build the DataTable that will back the Dashboard grid / Excel export Dim dt As New DataTable("UserHomePages") dt.Columns.Add("UserName", GetType(String)) dt.Columns.Add("DisplayName", GetType(String)) dt.Columns.Add("Email", GetType(String)) dt.Columns.Add("IsActive", GetType(String)) dt.Columns.Add("HomePage", GetType(String)) ' ── 1. Get all users from the OneStream security store ──────────────── Dim allUsers As List(Of UserSummaryInfo) = BRApi.Security.Admin.GetUsers(si) For Each userSummary As UserSummaryInfo In allUsers Dim userName As String = userSummary.Name Dim displayName As String = userName Dim email As String = String.Empty Dim isActive As String = "Unknown" Dim homePage As String = "(Not Set)" Try ' ── 2. Load the full UserInfo object using the username ─────── Dim fullUser As UserInfo = BRApi.Security.Admin.GetUser(si, userName) If fullUser IsNot Nothing AndAlso fullUser.User IsNot Nothing Then displayName = If(String.IsNullOrWhiteSpace(fullUser.User.Name), userName, fullUser.User.Name) End If Catch userEx As Exception ' Continue with fallback values if user load fails End Try Try ' ── 3. Read the file from the OneStream Internal File System ── Dim filePath As String = String.Format("Internal\Users\{0}\UserAppSettings.xml", userName) Dim fileObj As XFFileEx = BRApi.FileSystem.GetFile( _ si, FileSystemLocation.ApplicationDatabase, filePath, True, True) If fileObj Is Nothing OrElse fileObj.XFFile Is Nothing Then homePage = "(No Settings File)" Else Dim xDoc As XDocument = Nothing If Not String.IsNullOrWhiteSpace(fileObj.XFFile.XMLData) Then xDoc = XDocument.Parse(fileObj.XFFile.XMLData) ElseIf fileObj.XFFile.ContentFileBytes IsNot Nothing _ AndAlso fileObj.XFFile.ContentFileBytes.Length > 0 Then Dim fileText As String = System.Text.Encoding.UTF8.GetString( _ fileObj.XFFile.ContentFileBytes) xDoc = XDocument.Parse(fileText) End If If xDoc IsNot Nothing Then Dim homePageElement As XElement = xDoc.Descendants("SilverlightHomePageUrl").FirstOrDefault() If homePageElement IsNot Nothing Then Dim rawValue As String = homePageElement.Value.Trim() Dim parts() As String = rawValue.Split(New String() {"&&"}, StringSplitOptions.RemoveEmptyEntries) ' Skip known non-dashboard segments and find the dashboard name Dim skipValues As New List(Of String) From {"true", "false", "default", "unknown"} Dim dashboardName As String = "(Not Set)" For Each part As String In parts Dim cleanPart As String = part.Trim() ' Skip the Dashboard: prefix segment If cleanPart.StartsWith("Dashboard:", StringComparison.OrdinalIgnoreCase) Then Continue For End If ' Skip known keyword segments If skipValues.Contains(cleanPart.ToLower()) Then Continue For End If ' First remaining segment is the dashboard name dashboardName = cleanPart Exit For Next homePage = dashboardName Else homePage = "(Not Set)" End If Else homePage = "(No Settings File)" End If End If Catch fileEx As Exception homePage = "(No Settings File)" End Try dt.Rows.Add(userName, displayName, email, isActive, homePage) Next ' ── 4. Sort by UserName for a clean output ─────────────────────────── Dim dv As New DataView(dt) dv.Sort = "UserName ASC" Dim sortedDt As DataTable = dv.ToTable() Return sortedDt Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function End Class End Namespace - smarshall2New Contributor II
Thanks! It doesn't seem to be pulling in the Default though. It is saying the "(No Settings File) for users that do have a settings file. Screenshot showing the information from a settings file for a user and the result from that user in the table
Related Content
- 24 days ago
- 2 years ago
- 2 years ago
- 3 years ago
- 4 years ago