How can a user pull data from a group it does not have read access to?

I have the following group with read access for one type of user:

'UWV Database upload': group {
		can-read: user .'Type'?'UWV'
		can-update: user .'Type'?'UWV'
		'Raw Data': collection ['id'] {
                *More code*

My collection refers to this group like this:

'Data CBS': collection ['id'] {
				'id': text -> ^ ^ ^ .'UWV Database upload'.'Raw Data'[]
				'First name': text = >'id'.'First name'
				'Last name': text = >'id'.'Last name'
                               *More data*
}

Now I need the collection to get some data but not have read access to all.

Is this possible?

Yes, that is possible. I would suggest the following solution:

'UWV Database upload': group {
	can-update: user .'Type'?'UWV'
	'Raw Data': collection ['id'] {
		'id': text
		'First name': text
		'Last name': text
		'Private Data': group {
			can-read: user .'Type'?'UWV'
			// private properties here
		}
1 Like

Thank you for the reply. The only problem I have with this solution is that I have multiple users that all need a reference to some of the raw data but cannot read all the raw data for security reasons. Your solution would make it only possible for one user to read their data. I want to pull some of the raw data because I want the user to be able to get the data they have access to from the raw data into their collection. I will try some things, appreciate the help :slight_smile:

In that case, it is not entirely clear to me what you aim to achieve. Can you explain it with a concrete example illustrating how it would work in your app?

Alright,

I have multiple collections for users that reference the main data set like so:

'user1': collection ['id'] {
 can-read: user .'Type'?'user1'
  'id': text -> ^ ^ ^ .'UWV Database upload'.'main data'[]
  'First name': text = >'id'.'First name'
  'Last name': text = >'id'.'Last name'
 'SSN': text = >'id'.'SSN'
}
'user2: collection ['id'] { //should not have access to the SSN
 can-read: user .'Type'?'user2'
  'id': text -> ^ ^ ^ .'UWV Database upload'.'main data'[]
  'First name': text = >'id'.'First name'
  'Last name': text = >'id'.'Last name'
}

Now I have the main data as a collection but none of the users should be allowed to see it:

'main data': collection ['id'] {
can-read: user .'Type'?'admin'
  'id': text
  'First name': text 
  'Last name': text 
  'SSN': text
* more data*
}

This will not work because the users cannot read the data. Is there a way to work around this?

1 Like

Hi Ebbe,

Your last post contained conflicting statements:

  1. Now I have the main data as a collection but none of the users should be allowed to see it:
  2. This will not work because the users cannot read the data. Is there a way to work around this?

If none of the users is allowed to see it, they cannot read it. This seems to me to describe the same thing twice. So why would you want a way around it?

What might be the direction you are thinking:

  • you want the main data collection to not be visible to partners
  • you do want selected entries to be visible to partners

Now, how can partners select entries when it is not visible to them? There it gets interesting.
There are multiple approaches possible:

  1. You trust the partner to get consent from somebody, that will give his/her BSN. The partner creates a subscription to that BSN by asking for one from the UWV. Of course, this can be ‘hacked’ by subscribing to BSN’s you don’t have permission for, so trusting the partner is required.
  2. You could use some kind of private key that allows the patner to ‘subscribe’ to a BSN in the UWV dataset. Preferably, this private key is created by the person who wants to share his/her data with the partner. The UWV can then handle a request (command) from the partner that contains a BSN & Private key and if both match, share the (allowed) data with the partner.

Allowing read access to the main dataset directly, to be able to select something, will allow the partner access to all data through that means.

Does this help?

Kind regards,
Rick

2 Likes

It could look like something like this in the case there is only one partner:

'UWV Allowance members': collection ['BSN'] {
               can-read: user . 'Partner'?'Yes' where ( . 'Partner Subscription'?'Yes' )
		'BSN': text
		'Work Capability': number 'percent'
		'Partner Subscription': stategroup (
			'No' { }
			'Yes' {
				'Since': number 'date-time' = creation-time
			}
		)
		'Permissions': collection ['Code'] {
			'Code': text
		}
	}
	'Subscribe Member': command {
		'BSN': text // existing BSN of the member
		'Permission': text // code that is given by the member to the partner
	} as $'args' => switch .'UWV Allowance members'[ $'args'.'BSN'] (
		| none => ignore
		| node as $ => switch $ .'Permissions'[ $^ $'args'.'Permission'] (
			| none => ignore
			| node => update $ (
				'Partner Subscription' = ensure 'Yes' ( )
			)
		)
	)
1 Like

Yes this would work,

This would however mean that the owner(UWV) has to manually push the data to their subscribers collections right? Ideally I would like the users to be able to pull the data in real tIme without having to request it from the UWV. I will see if I can make the collections from the customers update automatically with the data submitted via a command.

Thanks again it puts us on the right track.

Regards,
Ebbe

Hi Ebbe,

It doesn’t actually show anything about how to get the data from the UWV to the partners. That is where an interface connection would usually be added between the two systems.

To simulate a connection between the UWV and partner, you could create a derived collection. Something like this:

'Subscribed Members': collection = . 'UWV' . 'UWV Allowance Members'* . 'Partner Subsciption'?'Yes' {
   'Member': text -> ^ . 'UWV' . 'UWV Allowance Members'[] . 'Partner Subsciption'?'Yes' = jkey
}

If you would use Alan interfaces, it would look mostly the same as this.I will show something like that on Monday.

Kind regards,
Rick