cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Geethika_543
New Member

Restricting users to edit their data

Hello Everyone,

As I am new to power apps, I am trying to build an app where a manager can enter notes for his employees. So far, the app is working successfully. I am struck up with creating granular level permissions in the app. Please help me with the following scenario and how to proceed with restricting the managers to only see and edit their location data.

 

I have a table dbo.Manager_Information_Table

Division

Location

Manger Name

Email

1

NJ

dan

d@gmail.com

1

NJ

jon

j@gmail.com

2

KY

dan

d@gmail.com

1

NJ

kim

k@gmail.com

2

KY

greg

g@gmail.com

3

TN

greg

g@gmail.com

3

TN

dan

d@gmail.com

 

 

 

 

 

I have another table, where respective mangers should enter notes for their employee who belongs to their locations and divisions

 

dbo. Employee_Timesheet_Table

 

Employeename

Division

Location

TotalHoursworked

Notes by manager

E1

1

NJ

8

 

E2

2

KY

2

 

E3

3

TN

1

 

E4

1

NJ

7

 

E5

2

KY

6

 

E6

1

NJ

10

 

 

I am trying to create granular permissions to the mangers. So when they open the app they should be only able to see their employees who belong to their location.

For example: If Manager: dan opened the app he should be able to see data and edit notes only for his divisions and locations in the gallery as below

Employeename

Division

Location

TotalHoursworked

Notes by manager

E1

1

NJ

8

 

E2

2

KY

2

 

E4

1

NJ

7

 

E5

2

KY

6

 

E6

1

NJ

10

 

 

I have seen several articles but could not find an appropriate solution. Please help me with this.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

OnStart of the App Set a Variable:

If only filter Location
Set(varUserLocation,LookUp(Manager_Information_Table,Email=User().Email,Location));

Set(varUserDivison,LookUp(Manager_Information_Table,Email=User().Email,Division))

 

On the Gallery items Filter:
Filter(Employee_Timesheet_Table,Location=varUserLocation Or Division=varUserDivison)

 

Or
Filter(Employee_Timesheet_Table,varUserLocation in Location Or varUserDivison in Division)

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

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

2 REPLIES 2
eka24
Super User III
Super User III

OnStart of the App Set a Variable:

If only filter Location
Set(varUserLocation,LookUp(Manager_Information_Table,Email=User().Email,Location));

Set(varUserDivison,LookUp(Manager_Information_Table,Email=User().Email,Division))

 

On the Gallery items Filter:
Filter(Employee_Timesheet_Table,Location=varUserLocation Or Division=varUserDivison)

 

Or
Filter(Employee_Timesheet_Table,varUserLocation in Location Or varUserDivison in Division)

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

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

v-yutliu-msft
Community Support
Community Support

Hi @Geethika_543 ,

I've found a similar issue here:

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-restrict-Data-for-particular-specific...

Was this posted by you too?

Please notice the reply there.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,129)