> For the complete documentation index, see [llms.txt](https://docs.metalex.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metalex.tech/protocol-how-to-guides/configure-roles.md).

# Configure BorgAuth roles

Grant and revoke BorgAuth authority levels on a cyberCORP suite

Authority on a cyberCORP is held in its **BorgAuth** ACL. Roles are numeric levels in a hierarchy — see [Access control](/protocol-reference/access-control.md).

## The levels you'll use

| Level               | Meaning                                                                                                    |
| ------------------- | ---------------------------------------------------------------------------------------------------------- |
| `99` (`OWNER_ROLE`) | Owner. Can grant/revoke roles. Held by the suite's manager contracts.                                      |
| `98` (`ADMIN_ROLE`) | Admin. Gates operational functions (e.g. scrip compliance actions, hook updates). Any level `≥ 98` passes. |
| `200`               | Company officer. Set for an officer's address; `200 ≥ 99`, so officers also pass `onlyOwner`.              |
| `0`                 | No authority.                                                                                              |

## Grant an officer

The simplest path is `CyberCorp.addOfficer`, which records the officer **and** grants their address level `200`:

```solidity
import {CompanyOfficer} from "src/CyberCorpConstants.sol";

CyberCorp(cyberCorp).addOfficer(CompanyOfficer({
    eoa:     newOfficer,
    name:    "Sam Officer",
    contact: "sam@acme.example",
    title:   "Chief Financial Officer"
}));
```

Adding an address already listed as an officer reverts (`DuplicateOfficer`), and an address already holding a level *above* `200` keeps it — the grant never downgrades a custom role.

## Update an officer

`updateOfficer` replaces the record at an index — new title, contact, or a new address. When the address changes, the old one's level-`200` grant is revoked and the new one is granted under the same rules as `addOfficer`:

```solidity
CyberCorp(cyberCorp).updateOfficer(2, CompanyOfficer({
    eoa:     replacementOfficer,
    name:    "Pat Officer",
    contact: "pat@acme.example",
    title:   "Chief Financial Officer"
}));
```

One caveat for corps whose legacy state lists the same address at more than one index: the old address keeps its role while any other entry still lists it — only removing or updating away its last entry revokes it.

## Remove an officer

Either removes the officer record and revokes the level-`200` grant:

```solidity
CyberCorp(cyberCorp).removeOfficer(departedOfficer);
// or by index:
CyberCorp(cyberCorp).removeOfficerAt(2);
```

Removal only zeroes a level that is exactly `200` — a custom level granted directly on the BorgAuth survives the officer's removal — and only when the address isn't still listed at another index (legacy state may hold duplicates).

## Grant or revoke a role directly

To set any level directly, call `updateRole` on the BorgAuth contract. The caller must hold `OWNER_ROLE`.

```solidity
BorgAuth auth = BorgAuth(BorgAuthACL(cyberCorp).AUTH());
auth.updateRole(someAddress, 200);   // grant officer level
auth.updateRole(someAddress, 0);     // revoke
```

## Transfer ownership

Two-step, on the BorgAuth contract:

```solidity
auth.initTransferOwnership(newOwner);   // by current owner
// then, as newOwner:
auth.acceptOwnership();
```

## Renounce

`auth.zeroOwner()` sets the caller's level to `0`, permanently removing its admin control.

## Related

* [Access control reference](/protocol-reference/access-control.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.metalex.tech/protocol-how-to-guides/configure-roles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
