Created
September 12, 2024 18:54
-
-
Save bitner/424586be0a3fda6e6c7dab60403353ae to your computer and use it in GitHub Desktop.
Description of potential lookup table for eoapi auth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE roles ( | |
id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY, | |
name text UNIQUE NOT NULL | |
); | |
INSERT INTO roles (name) VALUES | |
('cargill'), | |
('bigfarm'), | |
('farmer') | |
; | |
CREATE TABLE role_membership ( | |
child_role int, | |
parent_role int, | |
); | |
INSERT INTO role_membership (child_role, parent_role) VALUES | |
(3,2), -- farmer belongs to bigfarm | |
(2,1) -- big farm belongs to cargill | |
; | |
CREATE TABLE role-filter ( | |
role int, | |
rule jsonb | |
); | |
INSERT INTO role_filter(role, rule) VALUES | |
(1, {"op":"eq","args":[{"property: "collection"},"cargillcollection"]}), | |
(2, {"op":"s_intersects","args":[{"property":"geometry"},{"geometry":...}]); | |
you could then use a recusive query to find all the rules that 'farmer' or any of 'farmer's parents have set on them. | |
"AND" together all those CQL fragments and add them to the search. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment