nodevisor/packages/groups at main · nodevisor/nodevisor · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

README.md

Nodevisor Logo

@nodevisor/groups

Manage system groups and user membership.

Part of Nodevisor — TypeScript Infrastructure Automation Platform

Install

npm install @nodevisor/groups

Quick Start

import $ from '@nodevisor/shell';
import Groups from '@nodevisor/groups';

const groups = $(Groups);

// Create a group
await groups.add('docker');

// Add a user to the group
await groups.addUser('runner', 'docker');

// Check membership
const userGroups = await groups.userGroups('runner');
console.log(userGroups); // ["runner", "docker"]

Remote Usage

const $server = $.connect({ host: '10.0.0.10', username: 'root' });
await $server(Groups).addUser('runner', 'docker');

API

Method Description
exists(name) Check if a group exists
add(name) Create a new system group
remove(name) Remove a system group
addUser(username, group) Add a user to a group
removeUser(username, group) Remove a user from a group
userGroups(username) List all groups a user belongs to
hasUser(username, group) Check if a user is a member of a group

Related Packages

Documentation

Full documentation available at nodevisor.com/docs/packages/groups

License

Nodevisor uses a single O'Saasy license across all packages and applications. See the full terms in LICENSE.