Files
spark/src/lib/api/services/UserService.proto
T
2018-11-06 18:12:31 -05:00

64 lines
1.8 KiB
Protocol Buffer

syntax="proto3";
package bts.api.user;
option csharp_namespace="bts.api.user";
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 AuthToken {
string token = 1;
}
message TokenPayload {
uint32 date = 1;
uint32 id = 2;
bool wheel = 3;
}
message GetUsersRequest {}
message GetUsersResponse { repeated User users = 1; string error = 2; }
message AddOrUpdateUserRequest {AuthToken token = 1; User user = 2;}
message RemoveUserRequest {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;
AuthToken token = 3;
uint32 user_id = 4;
bool can_create = 5;
}
message AuthenticateTokenRequest {AuthToken token = 1;}
message AuthenticateTokenResponse {bool is_valid = 1; string reason = 2; User user = 3;}
service UserService {
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";}
}