Option for an array of permissions to Lookup Entity
Provide an option for an array of permissions to client.permission.lookupEntity and have the response group entity IDs by permissions.
Hi @EgeAytin I was going through and thinking to pick this , possible to assign me pls ,What I am thinking is - Update Proto
- Modify
PermissionLookupEntityRequestto accept permissions as a list. - Change
PermissionLookupEntityResponseandPermissionLookupEntityStreamResponseto return data in the format<permission, list<EntityIds>>, with each key defaulting to an empty list. Update Lookup Engine - Adjust lookupEntity and lookupEntityStream to handle a list of permissions.
- Ensure the callback function returns permissions for specific
EntityIDsinLookupEntity. - Implement a schema walk for all permissions. If all permissions fail, return an error. Otherwise, process the successful ones further. After this I have two approach Approach 1 :-
- We have to somehow need to pass list of permissions to
EntityFilterfunction inschemaBasedEntityFilter.gofor which either we updatePermissionEntityFilterRequestproto's EntityReference as list of References , or we updateRelationReferenceproto's Relations as list of string which is used as permissions. - From EntityFilter function we need to invoke RelationshipLinkedEntrances function in
linkedSchema.gowhich invokes findEntrance function so we again need to update either this function accept target param as list of RelationReference or we have updated RelationReference with list of relations. - From Here for each permission we can invoke
findEntrancein a new goroutine and we need to make sure update of visits function to be thread safe and it saves us from some duplicate work and I think it should be pretty much optimized And finally from here we would got list of entrances and we can keep our rest of flow as almost same only i think function type would update according to our proto updates.
I would need your inputs if I am not missing anything and which way should we go should we update proto PermissionEntityFilterRequest or RelationReference
- Update relevant test cases and Add more test cases
Approach 2:-
- Just invoke EntityFilter from
lookup.goin for loop on all permission and each invoke toEntityFilterin a new goroutine and wait for all goroutine to be completed - Add more test cases
Approach 1 is more optimized but it would required to update lot of codebase and its kind of changing our main important base design Approach 2 is not optimized it may have some duplicate works while finding entrances and after that exploring those entrances also but it would be more simple
I would like to hear your valuable feedback before I invest my more time to start doing the coding stuff which way should we go or if you have some improvements or some other thought around same .
Hi @ankitsheoran1, firs approach seems legit you can go to that direction. If you need any help, just let us know. Happy hacking!