grantRoleToFarm
@nmi-agro/fdm-source / fdm-core/src / grantRoleToFarm
Function: grantRoleToFarm()
grantRoleToFarm(
fdm,principal_id,target,b_id_farm,role):Promise<void>
Defined in: fdm-core/src/farm.ts:324
Grants a specified role to a principal for a given farm via an invitation.
Checks if the acting principal has 'share' permission on the farm, then creates an invitation for the target. Delegates to createInvitation.
Parameters
fdm
any
The FDM instance providing the connection to the database.
principal_id
string
The identifier of the principal performing the grant (must have 'share' permission).
target
string
The username, email, or slug of the invitee.
b_id_farm
any
The identifier of the farm.
role
The role to be granted ('owner', 'advisor', or 'researcher').
"owner" | "advisor" | "researcher"
Returns
Promise<void>
Throws
If the acting principal does not have 'share' permission, or if any other error occurs.