web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery Visible to Adm...
Power Apps
Answered

Gallery Visible to Admin 'OnStart'

(0) ShareShare
ReportReport
Posted on by 5,345 Moderator

I have multiple screen-filling Galleries on one main screen.

I would like the app to open to the 'Admin' group with Gallery1 visible 'true' by default, and for the Gallery to be invisible to all others when they enter.

I have
UpdateContext({AdminGalleryVisible: true})
and 
UpdateContext({AdminGalleryVisible: false})
in two buttons (an existing condition I'd like to keep), and I have the following in Gallery1.Visible -

     AdminGalleryVisible || (JobTitleLbl.Text ="Manager" || "Supervisor" || "Director")

AdminGalleryVisible is for manual control of Gallery visibility, the rest should make Gallery1 visible by default to Admin at 'OnStart'.

Categories:
  • SebS Profile Picture
    4,882 Super User 2026 Season 2 on at

    @Phineas 

     

    The easiest way to achieve this :

     

    1. Create a Sharepoint List called AdminList

    2. Add Columns all single Text "FullName","Mail","Role" - the role is not important but that's if, in future you would like to restrict Admins based on a job role 🙂

     

    3. Add the connection to this List from Power Apps

     

    4. on Start, You will need to create a variable called IsAppAdmin it will look like this

     

     

     

     

    Set(
     varIsAppAdmin,
     !IsBlank(
     Find(
     Lower(User().Email),
     Concat(
     AdminList,
     Mail,
     ";"
     )
     )
     )
    );

     

     

     

     

    5. Run OnStart to initialise this

    6. go to the Visible gallery property and place the variable varIsAppAdmin there

    7. Create a Settings button in the Menu also, use varIsAppAdmin to restrict access to the button

    8. create form to add remove admins from AdminList

    9. Enjoy full Admin Security 🙂

     

    You can build a tier system like that also this is a simple option rather than building all that, You could rather the AdminList use AD Security Groups and use  Office365Groups.ListGroupMembers("GroupToken").value to veryfie if someone is in the Security group called Admin also You can add few more Groups like that and power whole security of the app

     

    to use this approuch it's nearly same but you create additional variable

     

    Set(varAdminGroup, Office365Groups.ListGroupMembers("GroupToken").value)

     

    Than You use same code as above :

     

    Set(
     varIsAppAdmin,
     !IsBlank(
     Find(
     Lower(User().Email),
     Concat(
     varAdminGroup,
     mail,
     ";"
     )
     )
     )
    );

     

    the Mail need to be lower case for group 🙂

     

    And then you control everything from AD Group and additional you have access to Job role Location and other properties of M365 User Account

  • Phineas Profile Picture
    5,345 Moderator on at

    The (JobTitleLbl.Text = "Manager" || "Supervisor" || "Director") is pulling those Job Titles from the AD.

    Can I not use the JobTitle.Text in your coding, rather than creating a new list, as the information required is already available, validated, controlled and updated by others?

  • SebS Profile Picture
    4,882 Super User 2026 Season 2 on at

    @Phineas 

     

    If Your JobTitleLbl.Text already pulling JobRole from MS365 User Account, and You do not want to do anything fancy, and all People with that Job title have Admin Privilege.

     

    You don't need to do anything just add (JobTitleLbl.Text = "Manager" || "Supervisor" || "Director") to Gallery1 Visible property so if JobTitleLbl.Text containing any of the titles automatically the Gallery will be Visible and You don't need UpdateContext({AdminGalleryVisible: true}). You can also remove AdminGalleryVisible || as it's no need for it the real question is at what point the label JobTitleLbl.Text is populated but You could

    use on start variable  :

     

    Set(varAdminAccess,JobTitleLbl.Text = "Manager" || "Supervisor" || "Admin");

     

    And pass varAdminAccess to Gallery1 Visible property

     

     

     

     

     

     

     

  • Phineas Profile Picture
    5,345 Moderator on at

    I also want the ability for the 'Admin' user to close their Gallery and see what the other see, which is why I kept the UpdateContext..., which had the coding connect to the two buttons that closes the 'Admin' gallery and associated buttons, comboboxes, and other, that I referenced.

    Admin should be able to open the app and default view should be their admin gallery and functions. if after, they choose to see what 'Non-Admin' can see they can press the 'Close View' button -

    Click button with - Admin UpdateContext({AdminGalleryVisible: false})

    and if they want to see their view again...
     

    Click button with UpdateContext({AdminGalleryVisible: true})

  • Verified answer
    SebS Profile Picture
    4,882 Super User 2026 Season 2 on at

    @Phineas 

     

    In that case change AdminGalleryVisible from update Context to  

     

     

     

    Set(AdminGalleryVisible,true)

     

     

     

    and add it to OnStart add also to OnStart below variable

     

     

     

    Set(varAdminAccess,JobTitleLbl.Text = "Manager" || "Supervisor" || "Admin")

     

     

     

    Then in the Gallery Visible property, add 

     

     

     

    varAdminAccess && AdminGalleryVisible 

     

     

     

    Now in the button, what Admin will be able to select to Turn off Gallery1 Just add 

     

     

     

    Set(AdminGalleryVisible,!AdminGalleryVisible)

     

     

     

    That should work

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard