accountuserep

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountUserSvcConfig

type AccountUserSvcConfig struct {
	// CoreClient (required) is the core-service gRPC client.
	CoreClient pb.CoreServiceClient
}

type ActivateAccountUserEndpoint

type ActivateAccountUserEndpoint struct{}

Activates a disabled or removed account user, restoring their access to the account you are acting in.

Reactivation consumes a seat, so the request fails if the account is at its seat limit. Activating an already-active user is a no-op.

type ActivateAccountUserRequest

type ActivateAccountUserRequest struct {
	// ID of the account user to activate.
	AccountUserID string `path:"id" validate:"required"`
}

Request to activate an account user.

type CreateAccountUserEndpoint

type CreateAccountUserEndpoint struct{}

Adds a user to the account you are acting in.

If no user with the given email or username exists, a new user is created; a user created with an email address is sent a welcome email containing a generated password, unless they are being added to a supplier account, since suppliers have no portal to sign in to. If a matching user already exists, that user is added to the account instead, and a user you previously removed is restored rather than duplicated. Adding a user to your own account consumes a seat and is rejected once your plan's seat limit is reached.

When you add a user to a customer or supplier account that has its own OpenMRP subscription, the membership is created disabled and has to be activated before that user can sign in.

func (*CreateAccountUserEndpoint) Materialize

type CreateAccountUserRequest

type CreateAccountUserRequest struct {
	// User display name.
	Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
	// User email address.
	//
	// Either `email` or `username` must be provided. If a user with this email already exists, that user is added to the account instead of a new user being created, and the request fails with a conflict if they are already an active member of it.
	Email field.Optional[string] `json:"email,omitzero" validate:"omitempty,custom_email,max=255"`
	// Unique username.
	//
	// 3–255 characters; letters, numbers, underscores, and hyphens. Either `email` or `username` must be provided. Providing a username without an email creates a scanning station user.
	Username field.Optional[string] `json:"username,omitzero" validate:"omitempty,username"`
	// Password for scanning station users.
	//
	// Required when creating a scanning station user (username without email) and rejected for all other users, who instead receive a generated password in their welcome email. Must be 8–72 characters and include an uppercase letter, a lowercase letter, a number, and a special character.
	Password field.Optional[string] `json:"password,omitzero" validate:"omitempty,password" sensitive:"true"` // #nosec G117 -- API request field for user password input
	// ID of the role to assign to the user.
	//
	// The role you supply can be overridden: users added to a customer account always receive the shared customer role so their portal capabilities stay permission-driven, and scanning station users in any other account receive the scanner role. Supplying a role whose type is `sales_rep` normalizes to the account's canonical sales-rep role.
	RoleID field.Optional[string] `json:"role_id,omitzero"`
	// ID of the department to assign to the user.
	//
	// The department must already exist in the account you are acting in.
	DepartmentID field.Optional[string] `json:"department_id,omitzero"`
	// Whether the user can be assigned as a sales representative on orders, territories, and targets.
	//
	// Defaults to false. Forced true for the `sales_rep` role type and rejected for scanner and agent roles.
	IsCommissionEligible field.Optional[bool] `json:"is_commission_eligible,omitzero"`
	// Notification preference toggles for the new user.
	//
	// Only applies when creating a user in another account you manage (cross-account); ignored when creating a user in your own account.
	Preferences []NotificationPreferenceItem `json:"preferences,omitzero"`
}

Request to create an account user.

func (*CreateAccountUserRequest) SchemaExample

func (*CreateAccountUserRequest) SchemaExample() any

type DisableAccountUserEndpoint

type DisableAccountUserEndpoint struct{}

Disables (locks) an account user.

Disabled users cannot access the account and their active sessions are revoked, but the membership and its role assignment are kept so access can be restored with the activate action. Disabling frees the seat the user occupied. Admin users cannot be disabled, you cannot disable yourself, and removed users must be activated before they can be disabled. Disabling an already-disabled user is a no-op.

type DisableAccountUserRequest

type DisableAccountUserRequest struct {
	// ID of the account user to disable.
	AccountUserID string `path:"id" validate:"required"`
}

Request to disable an account user.

type ListAccountUsersEndpoint

type ListAccountUsersEndpoint struct{}

Returns a paginated list of the users who belong to the account you are acting in.

When the account you are acting in is a customer or supplier account you manage, this lists that account's users rather than your own team.

type ListAccountUsersRequest

type ListAccountUsersRequest struct {
	apiresource.PaginationRequest
	// Filter by role type.
	//
	// - `admin`: account administrators.
	// - `user`: users with a custom role.
	// - `scanner`: scanning station users.
	// - `sales_rep`: sales representatives.
	// - `agent`: automated agents.
	RoleType *constants.RoleType `query:"role_type"`
	// Filter by commission eligibility.
	//
	// Exact match on the column. Pass `true` to list users who can be assigned as sales representatives, including dedicated `sales_rep` users.
	IsCommissionEligible *bool `query:"is_commission_eligible"`
	// Controls whether removed (soft-deleted) account users appear in the list.
	//
	// Removed users are left out unless you pass `included`, so a user removed with the remove action disappears from the default listing.
	RemovedScope *constants.RemovedResourceScope `query:"removed_scope"`
}

Request to list account users.

type NotificationPreferenceItem

type NotificationPreferenceItem struct {
	// Notification type.
	NotificationTypeCode constants.AccountRelationNotificationType `json:"notification_type" validate:"required"`
	// Whether this notification type is enabled for the account user.
	Enabled bool `json:"enabled"`
}

NotificationPreferenceItem toggles a single account-relation notification type.

type RemoveAccountUserEndpoint

type RemoveAccountUserEndpoint struct{}

Removes a user from the account you are acting in.

Removal is a soft delete: removed users are excluded from listings unless requested via `removed_scope`, they free the seat they occupied, and they can be restored with the activate action. Removing an already-removed user is a no-op. The user's profile itself is untouched, so their access to any other account they belong to is unaffected.

func (*RemoveAccountUserEndpoint) Materialize

type RemoveAccountUserRequest

type RemoveAccountUserRequest struct {
	// ID of the account user to remove.
	AccountUserID string `path:"id" validate:"required"`
}

Request to remove an account user.

type RetrieveAccountUserEndpoint

type RetrieveAccountUserEndpoint struct{}

Returns an account user by ID.

The lookup is scoped to the account you are acting in, so an ID belonging to another account is reported as not found.

func (*RetrieveAccountUserEndpoint) Materialize

type RetrieveAccountUserRequest

type RetrieveAccountUserRequest struct {
	// ID of the account user to retrieve.
	AccountUserID string `path:"id" validate:"required"`
}

Request to retrieve an account user.

type UpdateAccountUserEndpoint

type UpdateAccountUserEndpoint struct{}

Partially updates an account user.

Omitted fields are left unchanged. Profile fields (`name`, `email`, `username`) update the underlying user, which is shared across every account the user belongs to, so the change is visible everywhere that person works.

func (*UpdateAccountUserEndpoint) Materialize

type UpdateAccountUserRequest

type UpdateAccountUserRequest struct {
	// ID of the account user to update.
	AccountUserID string `path:"id" validate:"required"`
	// User display name.
	Name field.Optional[string] `json:"name,omitzero" validate:"omitempty,max=255"`
	// User email address.
	//
	// Must not already be in use by another user.
	Email field.Optional[string] `json:"email,omitzero" validate:"omitempty,custom_email,max=255"`
	// Unique username.
	//
	// 3–255 characters; letters, numbers, underscores, and hyphens. Must not already be in use by another user.
	Username field.Optional[string] `json:"username,omitzero" validate:"omitempty,username"`
	// ID of the role to assign to the user.
	//
	// Set to `null` to clear the role.
	RoleID field.Clearable[string] `json:"role_id,omitzero" validate:"omitempty"`
	// ID of the department to assign to the user.
	//
	// Set to `null` to clear the department. The department must already exist in the account.
	DepartmentID field.Clearable[string] `json:"department_id,omitzero" validate:"omitempty"`
	// Whether the user can be assigned as a sales representative on orders, territories, and targets.
	//
	// Forced true for the `sales_rep` role type and rejected for scanner and agent roles. Cannot be turned off while the user stays on a `sales_rep` role.
	IsCommissionEligible field.Optional[bool] `json:"is_commission_eligible,omitzero"`
	// Notification preference toggles to apply.
	//
	// Only allowed when updating a user in another account you manage (cross-account); rejected otherwise. Notification types omitted from the list are left unchanged.
	Preferences []NotificationPreferenceItem `json:"preferences,omitzero"`
}

Request to partially update an account user.

func (*UpdateAccountUserRequest) SchemaExample

func (*UpdateAccountUserRequest) SchemaExample() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL