UserType Enumeration
Assembly: CodeEffects.Rule.Repository.dll
Namespace: CodeEffects.Rule.Repository.Common
Summary
Specifies what is making a request to the Rule Repository: a person, an AI agent acting on its own, or a service with no person behind it.
Syntax
public enum UserType
{
// A person. The default: a configuration that does not say is a person's
User = 1,
// An AI agent acting on its own, with no person it acts for
Agent = 2,
// Automation with no person behind it: a scheduled job, a pipeline, another system
Service = 3
}
To the repository everything that acts is a user, of one of these types. The type is stored with the user and shown beside the user's name, and whoever acts is credited with the work. A record the repository wrote without any user, such as a source synchronized by a call that names nobody, is shown as written by the system. The system is not a member of this enumeration.
The enumeration appears in three places:
Only a person makes a version live, takes one offline, requests or declines approval, or deletes. An agent's or a service's saves always request approval. Set the type from your own authentication of the caller, for example from a client-credentials token, never from anything the caller says about itself. The IDs of people, agents, and services must be unique across all three types.
An AI agent that acts on behalf of a person does not change the type of the request: the person stays the current user, and you name the agent through CurrentAgentId and CurrentAgentName. Use Agent only when the agent acts on its own.
Example
using CodeEffects.Rule.Repository;
using CodeEffects.Rule.Repository.Common;
// A scheduled job that calls the repository without a person
var config = new Configuration
{
CurrentUserId = "nightly-import",
CurrentUserName = "Nightly import",
CurrentUserType = UserType.Service
};
// A deployment pipeline that synchronizes sources
var settings = new SourceSettings
{
UserId = "deploy-pipeline",
UserType = UserType.Service
};