Package com.axelor.ai.agent
Class AgentGrants
java.lang.Object
com.axelor.ai.agent.AgentGrants
An agent's permissions, as entries: what an agent file's
permissions lists and what the
Agent Builder sets, one entry per object — "*" for every operation on every model,
"Order read update" for those operations on one.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne entry: the object, and the operations granted on it. -
Method Summary
Modifier and TypeMethodDescriptionentries(List<AgentGrants.Grant> grants) The entries as an agent file lists them.static List<AgentGrants.Grant> The agent's permissions, by object.static List<AgentGrants.Grant> parse(Collection<String> entries) The entries, read: each an object and the operations it grants, none naming all four.static voidreplace(AiAgent agent, List<AgentGrants.Grant> grants) Replaces the agent's permissions with these, in place: a row on an object both name keeps its id and takes the new operations, since inserting its replacement before removing it would break the unique object per agent.static voidKeeps the agent's rows canonical: each object asPermissionObjects.canonical(java.lang.String)gives it, and named once.
-
Method Details
-
parse
The entries, read: each an object and the operations it grants, none naming all four. An entry naming an object twice merges.- Throws:
IllegalArgumentException- naming every entry that names nothing or an unknown operation
-
of
The agent's permissions, by object. -
replace
Replaces the agent's permissions with these, in place: a row on an object both name keeps its id and takes the new operations, since inserting its replacement before removing it would break the unique object per agent. The agent must be saved after. -
validate
Keeps the agent's rows canonical: each object asPermissionObjects.canonical(java.lang.String)gives it, and named once.- Throws:
IllegalArgumentException- naming every row that names nothing, or an object twice
-
entries
The entries as an agent file lists them.
-