syntax="proto3"; package bts.api.user; option csharp_namespace="bts.api.user"; import "lib/api/apicore.proto"; import "lib/api/apioptions.proto"; message OperatorID { string tag50 = 10; } message Operator { OperatorID operator_id = 10; bool can_trade = 20; } message Entitlement { string mic_code = 10; } enum UserType { USERTYPE_NORMAL = 0; USERTYPE_ADMIN = 1;} message User { string login = 1 [(bts.api.key)=true]; // string password = 2; uint32 id = 3; UserType user_type = 10; repeated Operator operators = 100; repeated Entitlement entitlements = 200; } message TokenPayload { uint64 date = 1; uint32 id = 2; bool wheel = 3; } message GetUsersRequest {} message GetUsersResponse { repeated User users = 1; string error = 2; } message AddOrUpdateUserRequest { api.AuthToken token = 1; User user = 2;} message RemoveUserRequest {api.AuthToken token = 1; string login = 2;} message UserOperationResponse { bool is_valid = 1; string reason = 2;} message AuthenticateLoginRequest {string login = 1; string password = 2;} message AuthenticateLoginResponse { bool is_valid = 1; string reason = 2; api.AuthToken token = 3; uint32 user_id = 4; bool can_create = 5; } message AuthenticateTokenRequest {api.AuthToken token = 1;} message AuthenticateTokenResponse {bool is_valid = 1; string reason = 2; User user = 3;} service AuthService { option (bts.api.service_description) = "Provides a management interface to the system user list"; rpc authenticate_login(AuthenticateLoginRequest) returns (AuthenticateLoginResponse) {option (bts.api.method_description)="Returns wheter the login/password combination is valid and a 'Authorization Token' used for further API calls";} rpc get_users(GetUsersRequest) returns (GetUsersResponse) {option (bts.api.method_description)="Returns list of valid users";} rpc clear_all_sessions(bts.api.VoidMessage) returns (bts.api.ResultMessage) {option (bts.api.method_description)="Clears all reserved auth sessions";} }