Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for an array of permissions to Lookup Entity #1366

Open
EgeAytin opened this issue Jul 18, 2024 · 2 comments
Open

Option for an array of permissions to Lookup Entity #1366

EgeAytin opened this issue Jul 18, 2024 · 2 comments
Assignees
Labels
area/services Issues related with api services and functionalities. feature request New feature or request

Comments

@EgeAytin
Copy link
Member

Provide an option for an array of permissions to client.permission.lookupEntity and have the response group entity IDs by permissions.

@EgeAytin EgeAytin added the feature request New feature or request label Jul 18, 2024
@EgeAytin EgeAytin added the area/services Issues related with api services and functionalities. label Jul 18, 2024
@ankitsheoran1
Copy link

ankitsheoran1 commented Jul 29, 2024

Hi @EgeAytin I was going through and thinking to pick this , possible to assign me pls ,What I am thinking is -
Update Proto

  1. Modify PermissionLookupEntityRequest to accept permissions as a list.
  2. Change PermissionLookupEntityResponse and PermissionLookupEntityStreamResponse to return data in the format <permission, list<EntityIds>>, with each key defaulting to an empty list.
    Update Lookup Engine
  3. Adjust lookupEntity and lookupEntityStream to handle a list of permissions.
  4. Ensure the callback function returns permissions for specific EntityIDs in LookupEntity.
  5. 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 :-
  6. We have to somehow need to pass list of permissions to EntityFilter function in schemaBasedEntityFilter.go for which either we update PermissionEntityFilterRequest proto's EntityReference as list of References , or we update RelationReference proto's Relations as list of string which is used as permissions.
  7. From EntityFilter function we need to invoke RelationshipLinkedEntrances function in linkedSchema.go which 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.
  8. From Here for each permission we can invoke findEntrance in 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

  1. Update relevant test cases and Add more test cases

Approach 2:-

  1. Just invoke EntityFilter from lookup.go in for loop on all permission and each invoke to EntityFilter in a new goroutine and wait for all goroutine to be completed
  2. 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 .

@EgeAytin
Copy link
Member Author

EgeAytin commented Aug 5, 2024

Hi @ankitsheoran1, firs approach seems legit you can go to that direction. If you need any help, just let us know. Happy hacking!

@EgeAytin EgeAytin assigned ankitsheoran1 and unassigned EgeAytin and tolgaOzen Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/services Issues related with api services and functionalities. feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants