Security Expression

Hey guys - I would like to limit who can see a certain view in the app using the security in Data>Tables>Security Filter.

I want Homestead Managers to be able to view the rows that have their name in it, but not not other Homestead Managerโ€™s names.

And then I also want Evaluators to be able to see all of the rows.

In the existing rows in this โ€œGarden Feedback Formโ€ spreadsheet, I have both columns for Homestead Manager names and Evaluator names.

In another spreadsheet, titled โ€œEmployeesโ€, I have a column of [Employee Names] which would be equal to the โ€œHomestead Managerโ€ names. And I have another Column where I have assigned people the status of โ€œEvaluatorโ€. I also have USEREMAIL() in this spreadsheet which I know I need for this all to work.

So how do I ask app sheet to show the view if the USEREMAIL() equals the name of the person in the spreadsheet? AND if you have status of Evaluator, you can see all rows?

Many thanks!
Miranda

0 12 271
12 REPLIES 12

Steve
Platinum 4
Platinum 4

What are the names of all the involved tables?

What are the names of each of the columns in those tables you think will be needed?

Is the โ€œEvaluatorโ€ status determined by a name in a column? Or by a column in the Employees table? Your description is unclear.

Hi Steve! Thanks for the help!

Here is a screenshot of the columns in the Garden Feedback Form table.

And here is a screenshot of the Employees table columns:

In the [Oversite] column, I have the word โ€œEvaluatorโ€ if someone is an evaluator, and blank if they are not.

What is the relationโ€“if anyโ€“between the Evaluator column of the Garden Feedback Form table and the occurrence of Evaluator in the Oversite column of the Employees table?

Yes, so they are related but I guess they arenโ€™t really linked in any way in AppSheet.

The [Evaluator] Column in the Garden Feedback form is a Ref to the [Employee Name] Column in the Employees table. And I have an initial value expression so that the Evaluatorโ€™s name comes up automatically when they add a new row (since they are the ones filling it out). This is my expression for that, which has been working:

LOOKUP(USEREMAIL(), Employees, Useremail, Employee Name)

[Employee Name] is the Key of the Employees table.

Now Iโ€™m realizing that I probably also need some kind of security feature so that only Evaluators can edit the form??

I guess I would do that Data>Garden Feedback Form>โ€œAre Updates Allowed?โ€

But then I would need a similar kind of expression that says, based on the USEREMAIL(), only allow people labelled as โ€œEvaluatorโ€ in the [Oversite] column of the Employees table to be able to edit, and then everyone else is View only.

Seems like it would be a similar expression for both scenarios, correct? I am rusty on my expressions having not done them since winterโ€ฆ

How are form rows added? If from the same app, youโ€™ll need to allow adds, too.

In the Are updates allowed? expression for the Garden Feedback Form table:

IF(
  ISNOTBLANK(
    FILTER(
      "Employees",
      AND(
        (USEREMAIL() = [Useremail]),
        ("Evaluator" = [Oversite])
      )
    )
  ),
  "UPDATES_ONLY",
  "READ_ONLY"
)

Ok, I tried the IF/ISNOTBLANK/FILTER expression, but it is not working. I tried viewing the app as one of the Gardeners (not an Evaluator) and I can still see other peopleโ€™s Feedback Forms.

Thoughts??

Try this as the security filter expression for the Garden Feedback Form table:

ISNOTBLANK(
  FILTER(
    "Employees",
    AND(
      (USEREMAIL() = [Useremail]),
      OR(
        ("Evaluator" = [Oversite]),
        ([Employee Name] = [_THISROW].[Homestead Manager])
      )
    )
  )
)

Thanks!! I got this when I pasted it into the window:

3X_d_2_d2fc6ab0d143cb5f10ff450377c16c8731dde1de.png

3X_6_e_6e71d8187a7d46ee356a1b42afcf7c993756c4cf.png

Hi Steve,

Ok I corrected those things, but itโ€™s still not working somehow. I still see all of the entries when I view the app as one of the Employees (not an Evaluator).

I think there may be something wrong with the expression even though it should โ€œworkโ€ in app sheet.:

I think the thing that isnโ€™t quite right is the part that says โ€œEvaluatorโ€ = [Oversite]. Because that isnโ€™t the case. The [Evaluator] column is the Employeeโ€™s name, whereas the [Oversite] column is marked as โ€œEvaluatorโ€ or blank. So I think in order to connect the Employeeโ€™s name in the [Evaluator] column, it would need to be a de-ref to the [Oversite] column and the text โ€œEvaluatorโ€ being TRUE. Does that make sense?

Lmk your thoughts on how that would pan out in an expression. Here is a look at the Employees table so you see what Iโ€™m talking aboutโ€ฆ

3X_f_8_f81b32d5d136a572cfe9a9a6f07c232b12835e39.png

Nope, it doesnโ€™t make sense.

In the expression I provided, ("Evaluator" = [Oversite]) is asking whether the Oversite column in a row of the Employee table contains the text value of Evaluator, which aligns with your table structure:

3X_5_4_541c6c4c376f7f13f9684e7cffc2e6c7c6d714e7.png

Have you tried the Test button in Expression Assistant?

Top Labels in this Space