Every business request in Beep Oil and Gas is scoped twice. First by company (a tenant and a company inside it), then, for lifecycle work, by the field the signed-in person has chosen. This page describes how both scopes work in the API and in the web application.

1. Company selection

Every request under /api, /hubs and /progressHub that is not an administration path must say which company it is for. The caller sends two request headers:

HeaderMeaningLimit checked by the API
X-OilGas-TenantThe tenant the company belongs toAt most 64 characters
X-OilGas-CompanyThe company (business associate) inside that tenantAt most 128 characters

The middleware that checks them runs after authentication and before authorization. It refuses the request in these cases:

StatusMessageCause
400Select exactly one tenant and company.A header was sent more than once.
400Select a tenant and company before accessing business data.A header is missing, empty or longer than its limit.
403An active OilGas account is required.The signed-in caller has no active OilGas account.
403This company is unavailable to your account.The account has no active membership in that company.

When the company is accepted, the API rebuilds the caller's identity for the request. Role and permission claims that came with the sign-in are removed, and the roles and permissions the selected company grants to the account are added. The same person can therefore hold different roles in different companies.

Administration paths

These paths do not need a company. They are called administration (control plane) paths:

  • /api/auth/repository
  • /api/identity (except /api/identity/security, which is company scoped)
  • /api/setup
  • /api/ppdm39/setup

On these paths a tenant may be given in the X-OilGas-Tenant header or in a tenantId query value. If both are given they must agree. When a tenant is given, the caller must hold the Administrator role, otherwise the API answers 403 with the message "A repository administrator is required.". Paths under /api/auth/repository validate their own selectors.

2. Field selection

A company can hold many fields. Lifecycle work (exploration, development, production, HSE, decommissioning and so on) always applies to one chosen field, called the current field. Three endpoints manage the choice:

MethodRoutePurpose
GET/api/field/fieldsLists the fields available in the company. Optional query value connectionName. Each item has FieldId, FieldName, Description, CurrentPhase and LastModifiedDate.
GET/api/field/currentReturns the stored current field for the signed-in account. The answer includes SelectionAvailable, which says whether the stored field can still be used, and the field details (name, location, discovery and first production dates, type, status, area).
POST/api/field/set-activeStores a new current field. The body carries Context (the selection review returned by the previous call), FieldId and an optional ConnectionName. The answer has Success, FieldId and ErrorMessage.

The selection is stored as a preference of the account in that company. In the code the stored selection is described as never granting access to the field: choosing a field only says which one you want to work on.

3. Field access on lifecycle endpoints

Endpoints under /api/field/current carry the RequireCurrentFieldAccess filter. For each request it does the following, in order:

  • Refuses with 401 when the caller is not authenticated.
  • Resolves the account, the selected company and the database that company is bound to.
  • Reads the stored field selection and checks that it belongs to this account, company and database.
  • Answers 400 with the message "Choose a currently available FIELD before opening its lifecycle." when the stored field is no longer available.
  • Answers 409 when a fieldId in the route or query string differs from the stored field.
  • Checks the account's access to the field asset. An endpoint can name a permission (for example HSE.ManageIncidents) and can require write access. Without access the answer is 403.
  • Restores the field as the active field of the lifecycle orchestrator for this request, reads the selection back and checks again that the account, company, database and field did not change while it was restored. Any change ends the request with a conflict or a forbidden answer.
  • Writes an authorization record with the policy name, user, asset type FIELD, field id, required permission, decision (Allowed, Denied or Error), endpoint, HTTP method, correlation id and client address.

The attribute is used in three forms in the controllers: with no argument (field access is enough), with "WRITE" or "READ" (a named permission) and with a permission name plus true (that permission and write access).

4. Field overview endpoints

These endpoints give the overview of the current field. Each answers 400 with "No active field selected." when the orchestrator has no current field.

MethodRouteAccess
GET/api/field/current/summaryfield access
GET/api/field/current/wellsfield access
GET/api/field/current/statisticsfield access
GET/api/field/current/timelinefield access
GET/api/field/current/dashboardfield access

The field lifecycle summary (FieldLifecycleSummary) holds these counts and dates: prospects, seismic surveys, exploratory wells, pools, development wells, facilities, pipelines, production wells, total production volume and last production date, abandoned wells, decommissioned facilities, the current lifecycle phase, the discovery date and the first production date.

5. In the web application

  • The company workspace page (/landing, also /) asks the person to choose the company whose work and data to open.
  • A Company selector and an Active field selector are shared components. The field selector reads "Choose a FIELD for available workbenches in the selected company."
  • The web application sends the tenant and company headers on its calls, including the live notification connection.

Field scoping is enforced by the API. Hiding a menu item in the web application is not a security control; every call is checked again as described above.