# User

## Content

To support collaboration features, the **Common** module of SpreadJS introduces the **[UserManager](/spreadjs/api/classes/GC.Spread.Common.UserManager)**[ ](/spreadjs/api/classes/GC.Spread.Common.UserManager)concept, defining users as **[IUser](/spreadjs/api/interfaces/GC.Spread.Common.IUser)**[ ](/spreadjs/api/interfaces/GC.Spread.Common.IUser)to facilitate user management. It also provides configuration options for user access permissions to documents. This document gives a detailed explanation of the user-related features in collaboration.

## User Capabilities

SpreadJS currently provides related function to **User**:

* **Set the current user:** Binds the current user to use their identity.
* **Get the current user:** Get the specified user info.
* **setPresences**: Synchronizes the presence status of other collaborative users.
* **getPresences:** Get the current presences.

### Set the Current User

The **[GC.Spread.Common.UserManager.current](/spreadjs/api/classes/GC.Spread.Common.UserManager#current)** method binds a user to the current enviornment, enabling the use of that user’s identity.

```typescript
const loginUserId = 'userID1';
GC.Spread.Common.UserManager.current(loginUserId);
```

**Description**: By calling the **[UserManager.current](/spreadjs/api/classes/GC.Spread.Common.UserManager#current)** method, you can set a user as the active user for the current enviornment. This operation determines the user’s identity, suitable for multi-user collaborative editing scenarios. After binding, the user’s **id**, **name**, and **color** properties may be used to identify the source of operations or display user status in the interface.

### Get the Current User

The **[GC.Spread.Common.UserManager.get](/spreadjs/api/classes/GC.Spread.Common.UserManager#get)** method retrieves the specified user information by user ID, used together with the **UserManager.current** method, it allows you to obtain information about the currently active user.

```auto
const currentUserID = GC.Spread.Common.UserManager.current();
const currentUserInfo = await GC.Spread.Common.UserManager.get(currentUserID);
```

### setPresences/getPresences

The [setPresences](/spreadjs/api/classes/GC.Spread.Sheets.Collaboration.Collaboration#setpresences)/[getPresences](/spreadjs/api/classes/GC.Spread.Sheets.Collaboration.Collaboration#getpresences) method is primarily used in multi-user collaboration to display the real-time presence status of other users (e.g., cursor position, selection areas).
For details, see [Presence](/spreadjs/docs/spreadjs-collaboration-server/spreadjs-sheets-collaboration/user/presence).