Terminal stuff

This commit is contained in:
Nadja von Reitzenstein Čerpnjak 2024-05-06 14:26:32 +02:00
parent a2552c6759
commit d4e6d048e3
5 changed files with 67 additions and 2 deletions

View File

@ -4,7 +4,6 @@ using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema"); $CSharp.namespace("FabAccessAPI.Schema");
using import "utils.capnp".L10NString; using import "utils.capnp".L10NString;
using import "main.capnp".Session;
struct AuthSupported { struct AuthSupported {
mechs @0 :List(Mechanism); mechs @0 :List(Mechanism);
@ -118,6 +117,9 @@ struct Response(Successful) {
} }
interface Authentication(Successful) { interface Authentication(Successful) {
mechanisms @3 () -> ( mechanisms :List(Mechanism) );
# Return the list of available mechanisms
step @0 ( data :Data ) -> Response(Successful); step @0 ( data :Data ) -> Response(Successful);
# Respond to a challenge with more data. A client MUST NOT call this after having received an # Respond to a challenge with more data. A client MUST NOT call this after having received an
# "successful" response. # "successful" response.

View File

@ -13,12 +13,16 @@ using import "utils.capnp".Map;
using import "utils.capnp".SturdyRef; using import "utils.capnp".SturdyRef;
using import "projects.capnp".Project; using import "projects.capnp".Project;
using import "traits.capnp".Hint; using import "traits.capnp".Hint;
using import "auth.capnp".Authentication;
interface Claimable { interface Claimable {
claim @0 ( project :Project ) -> Fallible(Claim, ClaimError); claim @0 ( project :Project ) -> Fallible(Claim, ClaimError);
# Returns NULL if the resource is *currently* not claimable. # Returns NULL if the resource is *currently* not claimable.
# Disown the returned claim capability to unclaim it. # Disown the returned claim capability to unclaim it.
claimSubstituteUser @1 ( project :Project ) -> Fallible(Authentication(Claim), ClaimError);
# If the client calling this call is not allowed to make a SU claim the returned authentication is a nullptr
struct ClaimError { struct ClaimError {
locked @0 :Text; locked @0 :Text;
} }

View File

@ -3,6 +3,22 @@
using CSharp = import "programming_language/csharp.capnp"; using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema"); $CSharp.namespace("FabAccessAPI.Schema");
using import "auth.capnp".Authentication;
using import "utils.capnp".Fallible;
using import "claim.capnp".Claim;
interface Project { interface Project {
} }
interface TerminalProjects {
getUserProjects @0 () -> ( authentication :Authentication(List(Project)) );
addClaimToProject @1 ( claim :Claim, project :Project ) -> Fallible(AddOk, AddError);
struct AddOk {
}
struct AddError {
}
}

View File

@ -8,6 +8,8 @@ using import "resource.capnp".RestoredResource;
using import "claim.capnp".Claim; using import "claim.capnp".Claim;
using import "utils.capnp".SturdyRef; using import "utils.capnp".SturdyRef;
using import "utils.capnp".Fallible; using import "utils.capnp".Fallible;
using import "projects.capnp".Project;
using import "auth.capnp".Authentication;
interface Resources { interface Resources {
restore @0 () -> ( resources :List(RestoredResource) ); restore @0 () -> ( resources :List(RestoredResource) );
@ -25,7 +27,10 @@ interface Resources {
getByUrl @4 ( url :Text ) -> ( resource :Resource ); getByUrl @4 ( url :Text ) -> ( resource :Resource );
# Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource. # Returns a NULL capability if the resource doesn't exist or a user doesn't have read permission for that resource.
acceptToken @5 ( token :SturdyRef ) -> Fallible(Claim, AcceptTokenError); acceptToken @5 ( token :SturdyRef, project :Project ) -> Fallible(Claim, AcceptTokenError);
acceptTokenSubstituteUser @7 ( token :SturdyRef, project :Project )
-> Fallible(Authentication(Claim), AcceptTokenError);
setAlias @6 ( original_resource_id :Text ) -> ( alias_id :Text ); setAlias @6 ( original_resource_id :Text ) -> ( alias_id :Text );
# Replace any set alias for the given resource id with a newly generated # Replace any set alias for the given resource id with a newly generated

38
terminalMain.capnp Normal file
View File

@ -0,0 +1,38 @@
@0xc71ee8fdf17f8372;
using CSharp = import "programming_language/csharp.capnp";
$CSharp.namespace("FabAccessAPI.Schema");
using import "auth.capnp".Authentication;
using import "resources.capnp".Resources;
using import "projects.capnp".TerminalProjects;
interface TerminalBootstrap
{
getAPIVersion @0 () -> Version;
# Returns the API version implemented by the server. As a client, you can compare this version with the local currentVersion.
getServerRelease @1 () -> ( name :Text, release :Text );
# Returns the server implementation name and version/build number Designed only for human-facing
# debugging output so should be informative over machine-readable.
# Example: ("bffhd", "0.3.1-f397e1e [rustc 1.57.0 (f1edd0429 2021-11-29)]")
getServerInfo @2 () -> ( spacename :Text, instanceurl :Text );
# Returns information about the server, which can be used to resolve MDNS to DNS and display the server name to the user.
mechanisms @3 () -> AuthSupported;
# Get a list of Mechanisms this server allows in this context.
createSession @4 ( mechanism :Text, upgrade :Text ) -> ( authentication :Authentication(TerminalSession) );
}
struct TerminalSession
{
resources @0 :Resources;
projects @1 :TerminalProjects;
users @2 :TerminalUsers;
}
interface TerminalUsers {
}