Team Management
This guide explains how to manage your team's access to your Lens primitives.
Lens uses a unified approach to access control for its primitives (apps, graphs, feeds, etc.). There are two types of roles:
Owner: The owner has full control over a primitive, including adding and removing admins and transferring ownership. The initial owner is the address that creates the primitive.
Admin: An admin can perform most actions except transferring ownership. See the individual primitive documentation for more details.
This document identifies as primitives the following Lens entities:
The steps are the same for all primitives, so we will just refer to them their primitive address.
Add Admins
You MUST be authenticated as Builder to make this request.
- TypeScript
- GraphQL
Use the addAdmins action to add Admins to an owned primitive.
Example
import { evmAddress } from "@lens-protocol/client";import { addAdmins } from "@lens-protocol/client/actions";
const result = await addAdmins(sessionClient, { admins: [evmAddress("0x1234…"), evmAddress("0x5678…")], address: evmAddress("0x90ab…"), // address of the primitive (app/graph/feed/etc)});
- TypeScript
- GraphQL
Finally, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Remove Admins
You MUST be authenticated as Builder to make this request.
- TypeScript
- GraphQL
Use the removeAdmins action to remove Admins from an owned primitive.
Example
import { evmAddress } from "@lens-protocol/client";import { removeAdmins } from "@lens-protocol/client/actions";
const result = await removeAdmins(sessionClient, { admins: [evmAddress("0x1234…"), evmAddress("0x5678…")], address: evmAddress("0x90ab…"), // address of the primitive (app/graph/feed/etc)});
- TypeScript
- GraphQL
Finally, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Fetch Admins
In some cases, you may need to fetch the list of admins for a primitive.
Since a Lens Account, by being a smart wallet, can potentially be a primitive's admin, you can also search admins by their username.
- TypeScript
- GraphQL
Use the paginated fetchAdminsFor action to fetch a list of admins for a primitive.
See the Pagination guide for more information on how to handle paginated results.
Transfer Ownership
The owner of a primitive can transfer ownership to another address.
You MUST be authenticated as Builder to make this request.
- TypeScript
- GraphQL
Use the transferPrimitiveOwnership action to prepare the transfer of ownership of a primitive.
Example
import { evmAddress } from "@lens-protocol/client";import { transferPrimitiveOwnership } from "@lens-protocol/client/actions";
const result = await transferPrimitiveOwnership(sessionClient, { address: evmAddress("0x5678…"), newOwner: evmAddress("0x1234…"),});
- TypeScript
- GraphQL
Finally, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.