syntax = "proto3"; package ai.verta.uac; option go_package = "github.com/VertaAI/modeldb/protos/gen/go/protos/public/uac"; option java_multiple_files = true; import "google/api/annotations.proto"; import "common/CommonService.proto"; message Empty { } message GetUser { string user_id = 1; string email = 2; string username = 3; } message GetUsers { repeated string user_ids = 1; repeated string emails = 2; repeated string usernames = 3; common.Pagination pagination = 4; message Response { repeated UserInfo user_infos = 1; int64 total_records = 2; } } message GetUsersFuzzy { string email = 2; string username = 3; common.Pagination pagination = 4; message Response { repeated UserInfo user_infos = 1; int64 total_records = 2; } } message IdServiceProviderEnum { enum IdServiceProvider { UNKNOWN = 0; GITHUB = 1; BITBUCKET = 2; GOOGLE = 3; VERTA = 4; SAML = 5; AD_OAUTH2 = 6; LDAP = 7; OKTA_SCIM = 8; // Not currently used as there is no way to tell SCIM sources apart AD_SCIM = 9; // Not currently used as there is no way to tell SCIM sources apart SCIM = 10; } } enum FlagEnum { UNDEFINED = 0; TRUE = 1; FALSE = 2; } message VertaUserInfo { bool individual_user = 1; string username = 2; uint64 refresh_timestamp = 3; uint64 last_login_timestamp = 4; string user_id = 5; FlagEnum publicProfile = 6; string workspace_id = 7; reserved 8; // Workspace that the user has selected as their default. Initializes to the user's personal workspace // When the user is added to their _first_ org, the default workspace automatically switches to that if it was the default value // This should be empty if the user is not the current user uint64 default_workspace_id = 9; string description = 10; } message UserInfo { string user_id = 1; string full_name = 2; string first_name = 3; string last_name = 4; string email = 5; IdServiceProviderEnum.IdServiceProvider id_service_provider = 6; repeated string roles = 7; string image_url = 8; string dev_key = 9; VertaUserInfo verta_info = 10; string secondary_dev_key = 11; bool disabled = 12; string job_title = 13; string company = 14; uint64 created_at = 15; } message CreateUser { UserInfo info = 1; string password = 2; // If empty, create one. message Response { UserInfo info = 1; } } message UpdateUser { UserInfo info = 1; string password = 2; // If empty, don't update. uint64 default_workspace_id = 3; // If empty, don't update. message Response { UserInfo info = 1; } } message DeleteUser { string user_id = 1; message Response { bool status = 1; } } message ChangeDevKeyForUser { string user_id = 1; } service UACService { // Get the current user information verifying JWT token rpc getCurrentUser (Empty) returns (UserInfo) { option (google.api.http) = { get: "/v1/uac/getCurrentUser" }; }; // adds new user developer key rpc addDevKey(Empty) returns (UserInfo) { option (google.api.http) = { post: "/v1/uac/addDevKey" body: "*" }; }; // deletes primary developer key rpc deletePrimaryDevKey(Empty) returns (UserInfo) { option (google.api.http) = { delete: "/v1/uac/deletePrimaryDevKey" body: "*" }; }; // deletes secondary developer key rpc deleteSecondaryDevKey(Empty) returns (UserInfo) { option (google.api.http) = { delete: "/v1/uac/deleteSecondaryDevKey" body: "*" }; }; // adds new user developer key rpc addDevKeyForUser(ChangeDevKeyForUser) returns (UserInfo) { option (google.api.http) = { post: "/v1/uac/addDevKeyForUser" body: "*" }; }; // deletes primary developer key rpc deletePrimaryDevKeyForUser(ChangeDevKeyForUser) returns (UserInfo) { option (google.api.http) = { delete: "/v1/uac/deletePrimaryDevKeyForUser" body: "*" }; }; // deletes primary developer key rpc deleteSecondaryDevKeyForUser(ChangeDevKeyForUser) returns (UserInfo) { option (google.api.http) = { delete: "/v1/uac/deleteSecondaryDevKeyForUser" body: "*" }; }; // Get the current user information verifying JWT token rpc getUser (GetUser) returns (UserInfo) { option (google.api.http) = { get: "/v1/uac/getUser" }; }; rpc getUsers (GetUsers) returns (GetUsers.Response) { option (google.api.http) = { post: "/v1/uac/getUsers" body: "*" }; }; rpc getUsersFuzzy (GetUsersFuzzy) returns (GetUsersFuzzy.Response) { option (google.api.http) = { post: "/v1/uac/getUsersFuzzy" body: "*" }; }; // For now, any user can create a new user rpc createUser (CreateUser) returns (CreateUser.Response) { option (google.api.http) = { post: "/v1/uac/createUser" body: "*" }; }; // Only current user can update themselves rpc updateUser (UpdateUser) returns (UpdateUser.Response) { option (google.api.http) = { post: "/v1/uac/updateUser" body: "*" }; }; // Only current user can delete themselves rpc deleteUser (DeleteUser) returns (DeleteUser.Response) { option (google.api.http) = { post: "/v1/uac/deleteUser" body: "*" }; }; }