// M-Files Server gRPC API 26.11. Generated from the M-Files Server IDL; do not edit.
// Documentation: https://developer.m-files.com/APIs/gRPC-API/
syntax = "proto3";

package MFiles;

import "mfiles/api/annotations.proto";
import "mfiles/structs.proto";

option csharp_namespace = "MFiles.Grpc";
option go_package = "github.com/M-Files/mfiles-grpc-api/go/mfiles;mfiles";
option java_multiple_files = true;
option java_package = "com.mfiles.grpc";
option objc_class_prefix = "MF_";

// An interface for managing anonymous authentication operations.
//
// This interface provides ability to enable or disable anonymous authentication.
//
// Turns anonymous access to the vault on or off, and tells whether it is on. Used by vault
// administration tools; applications that only read or write vault content do not need it.
//
// - [GetAnonymousAuthenticationSettings](mfiles:MFiles.IRPCAnonymousLoginOperations.GetAnonymousAuthenticationSettings)
//   reads the setting.
// - [SetAnonymousAuthenticationSettings](mfiles:MFiles.IRPCAnonymousLoginOperations.SetAnonymousAuthenticationSettings)
//   changes it.
//
// Both methods need a vault session whose user has the vault rights `manage_users` and
// `license_allows_modifications` ([VaultAccess](mfiles:MFiles.VaultAccess)); other users get
// "Access denied.".
//
// Anonymous access is a user account of the vault: the account `ANONYMOUS LOGON` of the domain
// `M-FILES AUTHORITY`. Turning it on creates that account or lets the existing one
// log in again; turning it off only stops the account from logging in. What anonymous users may
// see is governed by the permissions of that account, like for any other user. When it is on,
// clients log in with `AUTH_DATA_TYPE_ANONYMOUS` (see
// [Authentication and sessions](https://developer.m-files.com/APIs/gRPC-API/runtime/authentication/)).
// Without a session, [GetLoginSettings](mfiles:MFiles.IRPCLogin.GetLoginSettings) tells whether
// a host name allows anonymous login.
service IRPCAnonymousLoginOperations {
	option (mfiles.api.service) = { book: "vault" level: LEVEL_STANDARD title: "Anonymous login" };

	// Turns anonymous access to the vault on or off.
	//
	// - Requires the vault rights `manage_users` and `license_allows_modifications`.
	// - On: creates the anonymous user account if the vault has none, or allows the existing one to
	//   log in. Off: the account stays but can no longer log in. Calling with the current value
	//   changes nothing.
	// - If the vault has more than one anonymous user account, the call fails with "Not
	//   implemented.".
	// - Anyone who can reach the server can then read whatever the anonymous account is allowed to
	//   see. Check its permissions before turning anonymous access on.
	rpc SetAnonymousAuthenticationSettings( SetAnonymousAuthenticationSettingsRequest ) returns ( SetAnonymousAuthenticationSettingsResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}

	// Tells whether anonymous access to the vault is turned on.
	//
	// - Requires the vault rights `manage_users` and `license_allows_modifications`.
	// - Anonymous access counts as on when exactly one anonymous user account exists and it is allowed
	//   to log in.
	// - Not cacheable: the setting is not covered by the metadata structure version.
	rpc GetAnonymousAuthenticationSettings( GetAnonymousAuthenticationSettingsRequest ) returns ( GetAnonymousAuthenticationSettingsResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}
}

// The request of SetAnonymousAuthenticationSettings.
message SetAnonymousAuthenticationSettingsRequest {

	// Set `anonymous_authentication_enabled` to true to turn anonymous access on, false to turn it off.
	AnonymousAuthenticationSettings anonymous_authentication_settings = 1;
}

// The response of SetAnonymousAuthenticationSettings.
message SetAnonymousAuthenticationSettingsResponse {
}

// The request of GetAnonymousAuthenticationSettings.
message GetAnonymousAuthenticationSettingsRequest {
}

// The response of GetAnonymousAuthenticationSettings.
message GetAnonymousAuthenticationSettingsResponse {

	// The current setting. `anonymous_authentication_enabled` is false (unset) when anonymous access is off.
	AnonymousAuthenticationSettings anonymous_authentication_settings = 1;
}
