cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sbossler_079
Helper I
Helper I

Powerapps User restrictions

Dear Community,

 

I'm currently building a powerapp and struggling about to implement the following functionality:

 

I would like to make my app available for different sites within our company but at the same time restrict the access so that not everyone who has access to the app will be able to access the data from all the sites.

 

What I have done so far (see also attached picture with my table structure):

- I have created a table (using sharepoint lists) with our different locations

- created a second table which holds my users and I have added a lookup column linked to the locations table to be able to assign a user to one or multiple locations

- After the login screen of my app I have added a gallery which displays all the locations from my location table

- A user can select the location he wants to work on further and move to the next screen

 

My requirement:

- I want to basically display within this location gallery only the locations to which the user has currently access to (like maintained within the user table)

 

I have already tried to play around with the Search & Filter functions on the gallery item but I'm struggling to get this working due to multiple reasons.

 

Anyone has any ideas how I can achive this?

1 ACCEPTED SOLUTION

Accepted Solutions

Try:
Filter(LocationTable, PlantCode in MyPlantCode)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

Your description is very detailed, good.

 

Do a LooKup to pick the PlantCode which is the common field OnStart of the App:

  Set(MyPlantCode,LookUp(AuthorisationTable,Username=User().FullName,PlantCode))

 

Then to filter the Location table:

  Filter(LocationTable, PlantCode= MyPlantCode)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi eka24,

 

thanks for your help! I have tried to apply your steps however I'm struggling because the "PlantCode" Column is a multivalue lookup column.

 

The first part works fine but I'm not able to apply the filter as there's a DataType Mismatch: The MyPlantCode variable contains a table value (from the Sharepoint lookup column) but the filter expects a Text value.

 

Any idea how I could resolve this? Also the gallery should be filtered by all PlantCodes assigned to the current user.

 

Thanks,

Try:
Filter(LocationTable, PlantCode in MyPlantCode)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

I got it working by modifying your given formula a little bit:

Filter(Locationlist; Titel in Concat(MyPlantCode; Value))
 
Thanks a lot for the input!!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,641)