feat: import upstream ZITADEL Login V2 v4.20.4 source workspace

This commit is contained in:
Vib Tools committed 2026-11-22 04:15:54 -08:00
1 parent eadd0e558b
commit 4404849fc4
644 files changed
+153201 -10

No files matched your search

@@ -0,0 +1,236 @@
syntax = "proto3";
package zitadel.internal_permission.v2;
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";
import "zitadel/filter/v2/filter.proto";
import "zitadel/internal_permission/v2/query.proto";
import "zitadel/protoc_gen_zitadel/v2/options.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/internal_permission/v2;internal_permission";
// InternalPermissionService provides methods to manage permissions for resource
// and their management in Zitadel itself also known as "administrators".
//
// If you want to manage permissions and roles within your project or application,
// please use the AuthorizationsService.
service InternalPermissionService {
// List Administrators
//
// ListAdministrators returns all administrators and their roles matching the request and the caller's permissions to retrieve.
//
// Required permissions depend on the resource type:
// - "iam.member.read" for instance administrators
// - "org.member.read" for organization administrators
// - "project.member.read" for project administrators
// - "project.grant.member.read" for project grant administrators
// - no permissions required for listing own administrator roles
rpc ListAdministrators(ListAdministratorsRequest) returns (ListAdministratorsResponse) {
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {permission: "authenticated"}
};
}
// Create Administrator
//
// CreateAdministrator grants an administrator role to a user for a specific resource.
//
// Note that the roles are specific to the resource type.
// This means that if you want to grant a user the administrator role for an organization and a project,
// you need to create two administrator roles.
//
// Required permissions depend on the resource type:
// - "iam.member.write" for instance administrators
// - "org.member.write" for organization administrators
// - "project.member.write" for project administrators
// - "project.grant.member.write" for project grant administrators
rpc CreateAdministrator(CreateAdministratorRequest) returns (CreateAdministratorResponse) {
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {permission: "authenticated"}
};
}
// Update Administrator
//
// UpdateAdministrator updates the specific administrator role.
//
// Note that any role previously granted to the user and not present in the request will be revoked.
//
// Required permissions depend on the resource type:
// - "iam.member.write" for instance administrators
// - "org.member.write" for organization administrators
// - "project.member.write" for project administrators
// - "project.grant.member.write" for project grant administrators
rpc UpdateAdministrator(UpdateAdministratorRequest) returns (UpdateAdministratorResponse) {
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {permission: "authenticated"}
};
}
// Delete Administrator
//
// DeleteAdministrator revokes an administrator role from a user.
//
// In case the administrator role is not found, the request will return a successful response as
// the desired state is already achieved.
// You can check the deletion date in the response to verify if the administrator role was deleted during the request.
//
// Required permissions depend on the resource type:
// - "iam.member.delete" for instance administrators
// - "org.member.delete" for organization administrators
// - "project.member.delete" for project administrators
// - "project.grant.member.delete" for project grant administrators
rpc DeleteAdministrator(DeleteAdministratorRequest) returns (DeleteAdministratorResponse) {
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {permission: "authenticated"}
};
}
}
message ListAdministratorsRequest {
// Paginate through the results using a limit, offset and sorting.
optional zitadel.filter.v2.PaginationRequest pagination = 1;
// The field the result is sorted by. The default is the creation date.
// Beware that if you change this, your result pagination might be inconsistent.
AdministratorFieldName sorting_column = 2;
// Filter the administrator roles to be returned.
repeated AdministratorSearchFilter filters = 3;
}
message ListAdministratorsResponse {
// Pagination contains the current sequence and the total result count.
zitadel.filter.v2.PaginationResponse pagination = 1;
// Administrators contains the list of administrators matching the request.
repeated Administrator administrators = 2;
}
message CreateAdministratorRequest {
// UserID is the ID of the user who should be granted the administrator role.
string user_id = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
// Resource is the type of the resource the administrator roles should be granted for.
ResourceType resource = 2 [(google.api.field_behavior) = REQUIRED];
// Roles are the roles that should be granted to the user for the specified resource.
// Note that roles are currently specific to the resource type.
// This means that if you want to grant a user the administrator role for an organization and a project,
// you need to create two administrator roles.
repeated string roles = 3 [
(validate.rules).repeated = {
unique: true
items: {
string: {
min_len: 1
max_len: 200
}
}
},
(google.api.field_behavior) = REQUIRED
];
}
message ResourceType {
message ProjectGrant {
// ProjectID is the unique identifier of the project the project grant belongs to.
string project_id = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
// OrganizationID is the unique identifier of the organization the project was granted to
// and on which the administrator role should be granted.
string organization_id = 2 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
}
// Resource is the type of the resource the administrator roles should be granted for.
oneof resource {
option (validate.required) = true;
// Instance is the resource type for granting administrator privileges on the instance level.
bool instance = 1 [(validate.rules).bool = {const: true}];
// OrganizationID is required to grant administrator privileges for a specific organization.
string organization_id = 2;
// ProjectID is required to grant administrator privileges for a specific project.
string project_id = 3;
// ProjectGrantID is required to grant administrator privileges for a specific project grant.
ProjectGrant project_grant = 4;
}
}
message CreateAdministratorResponse {
// CreationDate is the timestamp when the administrator role was created.
google.protobuf.Timestamp creation_date = 1;
}
message UpdateAdministratorRequest {
// UserID is the ID of the user whose administrator roles should be updated.
string user_id = 1 [(validate.rules).string = {
min_len: 1
max_len: 200
}];
// Resource is the type of the resource the administrator roles should be granted for.
ResourceType resource = 2 [(google.api.field_behavior) = REQUIRED];
// Roles are the roles that the user should be granted.
// Note that any role previously granted to the user and not present in the list will be revoked.
repeated string roles = 3 [(validate.rules).repeated = {
unique: true
items: {
string: {
min_len: 1
max_len: 200
}
}
}];
}
message UpdateAdministratorResponse {
// ChangeDate is the timestamp when the administrator role was last updated.
google.protobuf.Timestamp change_date = 1;
}
message DeleteAdministratorRequest {
// UserID is the ID of the user whose administrator roles should be removed.
string user_id = 1 [(validate.rules).string = {
min_len: 1
max_len: 200
}];
// Resource is the type of the resource the administrator roles should be removed for.
ResourceType resource = 2 [(google.api.field_behavior) = REQUIRED];
}
message DeleteAdministratorResponse {
// DeletionDate is the timestamp when the administrator role was deleted.
// Note that the deletion date is only guaranteed to be set if the deletion was successful during the request.
// In case the deletion occurred in a previous request, the deletion date might not be set.
google.protobuf.Timestamp deletion_date = 1;
}
@@ -0,0 +1,234 @@
syntax = "proto3";
package zitadel.internal_permission.v2;
import "google/api/field_behavior.proto";
import "google/protobuf/timestamp.proto";
import "validate/validate.proto";
import "zitadel/filter/v2/filter.proto";
option go_package = "github.com/zitadel/zitadel/pkg/grpc/internal_permission/v2;internal_permission";
message Administrator {
// CreationDate is the timestamp when the administrator role was granted.
google.protobuf.Timestamp creation_date = 1;
// ChangeDate is the timestamp when the administrator role was last updated.
// In case the administrator role was not updated, this field is equal to the creation date.
google.protobuf.Timestamp change_date = 2;
// User is the user who was granted the administrator role.
User user = 3;
// Resource is the type of the resource the administrator roles were granted for.
oneof resource {
// Instance is returned if the administrator roles were granted on the instance level.
bool instance = 4;
// Organization provides information about the organization the administrator roles were granted for.
Organization organization = 5;
// Project provides information about the project the administrator roles were granted for.
Project project = 6;
// ProjectGrant provides information about the project grant the administrator roles were granted for.
ProjectGrant project_grant = 7;
}
// Roles are the roles that were granted to the user for the specified resource.
repeated string roles = 8;
}
message User {
// ID is the unique identifier of the user.
string id = 1;
// PreferredLoginName is the preferred login name of the user. This value is unique across the whole instance.
string preferred_login_name = 2;
// DisplayName is the public display name of the user.
// By default it's the user's first name and last name, their username or their email address.
string display_name = 3;
// The organization the user belong to.
string organization_id = 4;
}
message Organization {
// ID is the unique identifier of the organization the user was granted the administrator role for.
string id = 1;
// Name is the name of the organization the user was granted the administrator role for.
string name = 2;
}
message Project {
// ID is the unique identifier of the project the user was granted the administrator role for.
string id = 1;
// Name is the name of the project the user was granted the administrator role for.
string name = 2;
// OrganizationID is the ID of the organization the project belongs to.
string organization_id = 3;
}
message ProjectGrant {
// ID is the unique identifier of the project grant the user was granted the administrator role for.
string id = 1;
// ProjectID is the ID of the project the project grant belongs to.
string project_id = 2;
// ProjectName is the name of the project the project grant belongs to.
string project_name = 3;
// OrganizationID is the ID of the organization the project belongs to.
string organization_id = 4;
// GrantedOrganizationID is the ID of the organization the project grant belongs to.
string granted_organization_id = 5;
}
message AdministratorSearchFilter {
oneof filter {
option (validate.required) = true;
// Search for administrator roles by their creation date.
zitadel.filter.v2.TimestampFilter creation_date = 1;
// Search for administrator roles by their change date.
zitadel.filter.v2.TimestampFilter change_date = 2;
// Search for administrators roles by the IDs of the users who was granted the administrator role.
zitadel.filter.v2.InIDsFilter in_user_ids_filter = 3;
// Search for administrators roles by the ID of the organization the user is part of.
zitadel.filter.v2.IDFilter user_organization_id = 4;
// Search for administrators roles by the preferred login name of the user.
UserPreferredLoginNameFilter user_preferred_login_name = 5;
// Search for administrators roles by the display name of the user.
UserDisplayNameFilter user_display_name = 6;
// Search for administrators roles granted for a specific resource.
ResourceFilter resource = 7;
// Search for administrators roles granted with a specific role.
RoleFilter role = 8;
// Combine multiple authorization queries with an AND operation.
AndFilter and = 9;
// Combine multiple authorization queries with an OR operation.
// For example, to search for authorizations of multiple OrganizationIDs.
OrFilter or = 10;
// Negate an authorization query.
NotFilter not = 11;
}
}
message UserPreferredLoginNameFilter {
// Search for administrators by the preferred login name of the user.
string preferred_login_name = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
// Specify the method to search for the preferred login name. Default is EQUAL.
// For example, to search for all administrator roles of a user with a preferred login name
// containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
zitadel.filter.v2.TextFilterMethod method = 2 [(validate.rules).enum.defined_only = true];
}
message UserDisplayNameFilter {
// Search for administrators by the display name of the user.
string display_name = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
// Specify the method to search for the display name. Default is EQUAL.
// For example, to search for all administrator roles of a user with a display name
// containing a specific string, use CONTAINS or CONTAINS_IGNORE_CASE.
zitadel.filter.v2.TextFilterMethod method = 2 [(validate.rules).enum.defined_only = true];
}
message ResourceFilter {
message ProjectGrant {
// ProjectID is the unique identifier of the project the project grant belongs to.
string project_id = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
// OrganizationID is the unique identifier of the organization the project was granted to
// and on which the administrator role was granted too.
string organization_id = 2 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
}
// Search for administrators by the granted resource.
oneof resource {
option (validate.required) = true;
// Search for administrators granted on the instance level.
bool instance = 1 [(validate.rules).bool = {const: true}];
// Search for administrators granted on a specific organization.
string organization_id = 2;
// Search for administrators granted on a specific project.
string project_id = 3;
// Search for administrators granted on a specific project grant
// by providing both the project ID and the organization ID.
ProjectGrant project_grant = 4;
}
}
message RoleFilter {
// Search for administrators by the granted role.
string role_key = 1 [
(validate.rules).string = {
min_len: 1
max_len: 200
},
(google.api.field_behavior) = REQUIRED
];
}
message AndFilter {
repeated AdministratorSearchFilter queries = 1;
}
message OrFilter {
repeated AdministratorSearchFilter queries = 1;
}
message NotFilter {
AdministratorSearchFilter query = 1;
}
enum AdministratorFieldName {
ADMINISTRATOR_FIELD_NAME_UNSPECIFIED = 0;
ADMINISTRATOR_FIELD_NAME_USER_ID = 1;
ADMINISTRATOR_FIELD_NAME_CREATION_DATE = 2;
ADMINISTRATOR_FIELD_NAME_CHANGE_DATE = 3;
}