fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based

added Deactivate/ActivateOrg
This commit is contained in:
Iraq Jaber
2025-05-01 12:37:14 +02:00
parent 40de3d462a
commit 96831fb5f5
5 changed files with 308 additions and 98 deletions

View File

@@ -32,6 +32,7 @@ message Organization {
];
}
// TODO rename to OrgState
enum OrganizationState {
ORGANIZATION_STATE_UNSPECIFIED = 0;
ORGANIZATION_STATE_ACTIVE = 1;
@@ -80,7 +81,7 @@ message OrgDomainQuery {
}
message OrgStateQuery {
OrgState state = 1 [
OrganizationState state = 1 [
(validate.rules).enum.defined_only = true,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
description: "current state of the organization";
@@ -97,14 +98,3 @@ message OrgIDQuery {
];
}
enum OrgState {
ORG_STATE_UNSPECIFIED = 0;
ORG_STATE_ACTIVE = 1;
ORG_STATE_INACTIVE = 2;
ORG_STATE_REMOVED = 3;
}
enum OrgFieldName {
ORG_FIELD_NAME_UNSPECIFIED = 0;
ORG_FIELD_NAME_NAME = 1;
}

View File

@@ -249,7 +249,7 @@ service OrganizationService {
responses: {
key: "200";
value: {
description: "org removed successfully";
description: "org deleted successfully";
};
};
responses: {
@@ -266,6 +266,66 @@ service OrganizationService {
};
}
rpc DeactivateOrganization(DeactivateOrganizationRequest) returns (DeactivateOrganizationResponse) {
option (google.api.http) = {
post: "/v2beta/_deactivate"
body: "*"
};
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {
permission: "org.write"
}
http_response: {
success_code: 200
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Organizations";
summary: "Deactivate Organization";
description: "Sets the state of my organization to deactivated. Users of this organization will not be able to log in."
parameters: {
headers: {
name: "x-zitadel-orgid";
description: "The default is always the organization of the requesting user. If you like to get users of another organization include the header. Make sure the user has permission to access the requested data.";
type: STRING,
required: false;
};
};
};
}
rpc ReactivateOrganization(ReactivateOrganizationRequest) returns (ReactivateOrganizationResponse) {
option (google.api.http) = {
post: "/orgs/me/_reactivate"
body: "*"
};
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {
permission: "org.write"
}
http_response: {
success_code: 200
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Organizations";
summary: "Reactivate Organization";
description: "Set the state of my organization to active. The state of the organization has to be deactivated to perform the request. Users of this organization will be able to log in again."
parameters: {
headers: {
name: "x-zitadel-orgid";
description: "The default is always the organization of the requesting user. If you like to get users of another organization include the header. Make sure the user has permission to access the requested data.";
type: STRING,
required: false;
};
};
};
}
}
message CreateOrganizationRequest{
@@ -387,3 +447,35 @@ message DeleteOrganizationRequest {
message DeleteOrganizationResponse {
zitadel.object.v2beta.Details details = 1;
}
//This is an empty request
message DeactivateOrganizationRequest {
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629023906488334\"";
min_length: 1;
max_length: 200;
}
];
}
message DeactivateOrganizationResponse {
zitadel.object.v2beta.Details details = 1;
}
//This is an empty request
message ReactivateOrganizationRequest {
string id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "\"69629023906488334\"";
min_length: 1;
max_length: 200;
}
];
}
message ReactivateOrganizationResponse {
zitadel.object.v2beta.Details details = 1;
}