Skip to content

Commit

Permalink
MG-2404 - Use Policy CRUD wrapper to directly talk to SpiceDB (#2405)
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru authored Sep 6, 2024
1 parent 3faee6f commit 415aaa1
Show file tree
Hide file tree
Showing 46 changed files with 2,854 additions and 10,160 deletions.
2,088 changes: 88 additions & 2,000 deletions auth.pb.go

Large diffs are not rendered by default.

153 changes: 3 additions & 150 deletions auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@ service AuthnService {
// PolicyService is a service that provides policy CRUD
// functionalities for magistrala services.
service PolicyService {
rpc AddPolicy(AddPolicyReq) returns (AddPolicyRes) {}
rpc AddPolicies(AddPoliciesReq) returns (AddPoliciesRes) {}
rpc DeletePolicyFilter(DeletePolicyFilterReq) returns (DeletePolicyRes) {}
rpc DeletePolicies(DeletePoliciesReq) returns (DeletePolicyRes) {}
rpc ListObjects(ListObjectsReq) returns (ListObjectsRes) {}
rpc ListAllObjects(ListObjectsReq) returns (ListObjectsRes) {}
rpc CountObjects(CountObjectsReq) returns (CountObjectsRes) {}
rpc ListSubjects(ListSubjectsReq) returns (ListSubjectsRes) {}
rpc ListAllSubjects(ListSubjectsReq) returns (ListSubjectsRes) {}
rpc CountSubjects(CountSubjectsReq) returns (CountSubjectsRes) {}
rpc ListPermissions(ListPermissionsReq) returns (ListPermissionsRes) {}
rpc DeleteEntityPolicies(DeleteEntityPoliciesReq) returns (DeletePolicyRes) {}
rpc DeleteUserPolicies(DeleteUserPoliciesReq) returns (DeletePolicyRes) {}
}

// If a token is not carrying any information itself, the type
Expand Down Expand Up @@ -86,144 +75,8 @@ message AuthorizeRes {
string id = 2;
}

message AddPolicyReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject_kind = 4;
string subject = 5;
string relation = 6;
string permission = 7;
string object = 8;
string object_kind = 9;
string object_type = 10;
}

message AddPoliciesReq{
repeated AddPolicyReq addPoliciesReq= 1;
}

message AddPolicyRes { bool added = 1; }

message AddPoliciesRes { bool added = 1; }

message DeletePolicyFilterReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject_kind = 4;
string subject = 5;
string relation = 6;
string permission = 7;
string object = 8;
string object_kind = 9;
string object_type = 10;
}

message DeletePoliciesReq {
repeated DeletePolicyReq deletePoliciesReq = 1;
}

message DeletePolicyReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject_kind = 4;
string subject = 5;
string relation = 6;
string permission = 7;
string object = 8;
string object_kind = 9;
string object_type = 10;
}

message DeletePolicyRes { bool deleted = 1; }

message ListObjectsReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string relation = 5;
string permission = 6;
string object = 7;
string object_type = 8;
string nextPageToken = 9;
uint64 limit = 10;
}

message ListObjectsRes {
repeated string policies = 1;
string nextPageToken = 2;
}

message CountObjectsReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string relation = 5;
string permission = 6;
string object = 7;
string object_type = 8;
string nextPageToken = 9;
}

message CountObjectsRes { uint64 count = 1; }

message ListSubjectsReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string relation = 5;
string permission = 6;
string object = 7;
string object_type = 8;
string nextPageToken = 9;
uint64 limit = 10;
}

message ListSubjectsRes {
repeated string policies = 1;
string nextPageToken = 2;
}

message CountSubjectsReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string relation = 5;
string permission = 6;
string object = 7;
string object_type = 8;
string nextPageToken = 9;
}

message CountSubjectsRes { uint64 count = 1; }

message ListPermissionsReq {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string object = 5;
string object_type = 6;
repeated string filter_permissions = 7;
}

message ListPermissionsRes {
string domain = 1;
string subject_type = 2;
string subject_relation = 3;
string subject = 4;
string object = 5;
string object_type = 6;
repeated string permissions = 7;
}

message DeleteEntityPoliciesReq{
string entity_type = 1;
string id = 2;
message DeleteUserPoliciesReq{
string id = 1;
}
Loading

0 comments on commit 415aaa1

Please sign in to comment.