https://github.com/tobitsoftware/chayns-uac-service
Package for access uac service
https://github.com/tobitsoftware/chayns-uac-service
Last synced: 2 months ago
JSON representation
Package for access uac service
- Host: GitHub
- URL: https://github.com/tobitsoftware/chayns-uac-service
- Owner: TobitSoftware
- Created: 2023-06-21T07:27:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-17T17:16:17.000Z (over 1 year ago)
- Last Synced: 2025-02-17T18:28:41.090Z (over 1 year ago)
- Language: JavaScript
- Size: 162 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## @chayns/uac-service
With this package Uac groups can be requested and edited. The package works in the frontend as well as in the node backend. In the background, the package uses protobuf for communication with the uac-service.
### Installation in frontend projects
1. Install package ```npm install @chayns/uac-service```
2. Create instance of UacServiceClient (could be in separate js/ts file in your project)
```js
import { getAccessToken, getLanguage, getSite, getUser } from 'chayns-api';
export const client = new UacServiceClient({
getToken: async () => ((await getAccessToken()).accessToken || ""),
getDefaultSiteId: () => getSite().id,
logger: logger, // your chayns logger instance
getDefaultPersonId: () => getUser()?.personId || "",
getLanguage: () => getLanguage().active
});
```
### Installation in node projects
1. Install package ```npm install @chayns/uac-service```
2. Create instance of UacServiceClient (could be in separate js/ts file in your project)
```js
export const client = new UacServiceClient({
getApiToken: async () => accessToken,
logger: logger, // your chayns logger instance
});
```
### Usage in front and backend projects
These are just a few examples, there are many more functions.
#### Create UserGroup
```js
const { id } = await client.createUserGroup({ showName: 'test name', users:['GER-TDNKN'], description: 'Beschreibung'});
```
#### Get all usergroups from site
```js
const result = await client.getUserGroups({ countUsers: true });
```
#### Get all users in group
```js
const members = await client.getGroupMembers({ groupId: 1 });
```
#### Add user to group
```js
await client.addUsersToGroup({ groupId: 1, members: [{personId: 'F69-1LT41'}] })
```