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

User level permission in a power app

I had the below working so that only people in the Approvers list could see all items and everyone else just sees items they create. For some reason, something must have changed because approvers. can no longer see any items, not even their own.  If I add myself to the group, I can see everything. Also, if I take my self out, I can only see ones created by me, so I do not understand what could be wrong. Below is my code and an explanation of some of the items. Can anyone see what is wrong here?

 

 

Approvers list is a Sharepoint list and Admin is a people lookup column where I have each user on a separate row. This list no one has access to but me. the PowerApp list all the users have edit permission in with the exception of "manage lists" which is unchecked.

 

Onstart code:

Set(
varUser,
User()
);

 

 

Set(
IsUserAdminSPList,
!IsBlank(
LookUp(
'Approvers list',
Admin.Email = varUser.Email
)
)
);

 

Gallery Items:

If(
IsUserAdminSPList = true,
Filter(
'PowerApp', StatusDrpDwn.Selected.Value = Status.Value || StatusDrpDwn.Selected.Value = "Sort By Status"
),Filter(
'PowerApp', 'Created By'.Email=User().Email && StatusDrpDwn.Selected.Value = Status.Value || 'Created By'.Email=User().Email && StatusDrpDwn.Selected.Value = "Sort By Status"
)
)

1 ACCEPTED SOLUTION

Accepted Solutions

@mgm05e ,

It should work - you need to test it with this on a Label - it should show true if the person is Admin

!IsBlank(
   LookUp(
      'Approvers list',
      Admin.Email = varUser.Email
  ).ID
)

however you said it was a Lookup field - I assumed you mean a Person field ? If a lookup field, what is it looking up and the user also needs access to that list as well.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @mgm05e ,

You should be able to do it all in one as below

With(
   {
      wAdmin:
      !IsBlank(
         LookUp(
            'Approvers list',
            Admin.Email = varUser.Email
         ).ID
      )
   }, 
   Filter(
      'PowerApp', 
      (
         StatusDrpDwn.Selected.Value = Status.Value || 
         StatusDrpDwn.Selected.Value = "Sort By Status"
      ) &&
      (
         wAdmin ||
         'Created By'.Email=User().Email
      )
   )
)

I assume you are testing for the existence of a record here. Clearly IsUserAdminSPList is not working as they would not have created any records.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

@WarrenBelz I am not following what you mean by "I assume you are testing for the existence of a record here. Clearly IsUserAdminSPList is not working as they would not have created any records." But it did not work unfortunately. It appeared to work when I tested it by adding my name to the list, but for some reason it doesn't work for anyone else in the list. The  IsUserAdminSPList  is supposed to set check the admin column and and check if the people in that columns email matches the users.  I used this video a while back and it was working at first. https://youtu.be/J-hMMXrKMVE?t=472.

Is it possible that some other permission is affecting this? I am the only one who has full control so that is all I can think of.

Hi @mgm05e ,

I need to assume that the logged in user has access to the 'Approvers list' as they need to read it to set the Variable,  so yes, this could be a permission issue. There also needs to be a record in the list where the Admin (I assume is a Person) Field contains the email address of the logged-in user (and then they can see all records).

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

Hello @WarrenBelz. I currently have the Admin's with view permission to the 'Approvers list'. Is this sufficient? The column uses the person look up field which does contain the email address of the logged in user.

 

 

@mgm05e ,

It should work - you need to test it with this on a Label - it should show true if the person is Admin

!IsBlank(
   LookUp(
      'Approvers list',
      Admin.Email = varUser.Email
  ).ID
)

however you said it was a Lookup field - I assumed you mean a Person field ? If a lookup field, what is it looking up and the user also needs access to that list as well.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (4,508)