Limiting data shown based on USER

Users and MembersUsers and Members

Hi, 

following on from my previous question...

I have two tables for ownership and membership of a Rubric. The idea is that the owner makes/edits it, and the members (eventually) may be able to view it and use it to mark dissertations etc.

I created a slice called "Rubrics Owner matches USEREMAIL" - and ideally I would like to show to both owners and members. 

Note: I'm not sure I'm going about this the best way. Partly because the Owner connection is a Ref keyed on email, and Members are a LIST and are mapped the other way.  

The problem is that I can get the user's email with USEREMAIL() but what good is it to me. 

Got there... as I was writing this I found the solution. In my case this did the basic owner test 

[_THISROW].[Owner].[Email] = USEREMAIL()

... onto chaining it with a members check OR()

I tried this and it returns access to all three Rubrics I have so far ... where my test user should only have access to two (one as an owner, and one as a member)

This is the Slice code

OR(
[_THISROW].[Owner].[Email] = USEREMAIL(), <-- this line works... so I only see Rubrics I've made
IN( USEREMAIL(), Members[Email]) <-- this seems to return false positives, I get to see all rubrics
)

Any pointers where this is going wrong - taking into account my quirky data model (maybe I should just have REFs onto Users at all points somehow?

Thanks 

Tom

Solved Solved
0 2 124
1 ACCEPTED SOLUTION

I've got it...

OR(
[_THISROW].[Owner].[Email] = USEREMAIL(),
IN( [Id],
SELECT(Members[Rubric], [Email]= USEREMAIL()] )
)
)

This works... Thanks for listening!

Tom

View solution in original post

2 REPLIES 2

Oh hang on... I realise my code says, in pseudocode...

If I am owner AND I am a member of any Rubric

I need to somehow match I am a member of the [_THISROW] Rubric.

I've got it...

OR(
[_THISROW].[Owner].[Email] = USEREMAIL(),
IN( [Id],
SELECT(Members[Rubric], [Email]= USEREMAIL()] )
)
)

This works... Thanks for listening!

Tom

Top Labels in this Space