Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ad

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ad - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "ad",
"version": "0.2.0",
"version": "0.2.1",
"description": "Active Directory API for Node",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,4 +7,4 @@ # AD

[https://img.shields.io/badge/build-passing-brightgreen.svg](Build Passing)
[https://img.shields.io/badge/build-100%25-brightgreen.svg](Coverage 100%)
[![Build Passing](.svg)](https://img.shields.io/badge/build-passing-brightgreen.svg)
[![Build Coverage 100%](.svg)](https://img.shields.io/badge/build-100%25-brightgreen.svg)

@@ -50,2 +50,9 @@

### Features
- Robust `user`, `group` and `ou` manipulation methods
- High and low-level search methods
- Caching by default
- Fancy result filtering including column and value filtering, sorting and pagination
## Getting Started

@@ -95,5 +102,5 @@

```bash
ad.user().get(opts)
ad.user().add(opts)
ad.user(username).get(opts)
ad.user().get(filter)
ad.user().add(options)
ad.user(username).get(filter)
ad.user(userName).exists()

@@ -114,5 +121,5 @@ ad.user(userName).addToGroup(groupName)

ad.group().get(opts)
ad.group().add()
ad.group(groupName).get(opts)
ad.group().get(filter)
ad.group().add(options)
ad.group(groupName).get(filter)
ad.group(groupName).exists()

@@ -123,4 +130,4 @@ ad.group(groupName).addUser(userName)

ad.ou().get(opts)
ad.ou().add(opts)
ad.ou().get(filter)
ad.ou().add(options)
ad.ou(ouName).get()

@@ -130,8 +137,11 @@ ad.ou(ouName).exists()

ad.other().get(opts)
ad.all().get(opts)
ad.other().get(filter)
ad.all().get(filter)
ad.find(searchString)
ad.cache(boolean)
ad.cacheTimeout(millis)
```
### User
### User Methods

@@ -177,3 +187,3 @@ #### ad.user().get(filter)

Returns a user object. If no user is matched, returns undefined.
Returns a user object. If no user is matched, returns `undefined`.

@@ -211,3 +221,3 @@ ```js

```js
await ad.user('jsmith').addToGroup('Sales');
await ad.user('jsmith').removeFromGroup('Sales');
// => {success: true}

@@ -347,2 +357,200 @@

### Group Methods
#### ad.group().get(filter)
Returns all group objects.
```js
await ad.group().get();
// => [{ ... }, { ... }];
```
#### ad.group().add(options)
Creates a new group. Returns the created group object.
##### Options:
* `name`: String (required)
* `location`: String
* `description`: String
```js
await ad.group().add({
name: 'HR'
location: '!Builtin',
description: 'Human Resources users.'
});
// => {sAMAccountName: 'HR' ... }
```
#### ad.group(groupName).get(filter)
Returns a group object. If no group is matched, returns `undefined`.
```js
await ad.group('HR').get();
// => {sAMAccountName: 'HR', description: 'Human...' ... }
```
#### ad.group(groupName).exists()
Returns a `Boolean` of whether the group account matched.
```js
await ad.group('Beastie Boys').exists();
// => false
```
#### ad.group(groupName).addUser(groupName)
Adds a user to a group.
```js
await ad.group('HR').addUser('bjones');
// => {success: true}
```
#### ad.group(groupName).removeUser(groupName)
Removes a user from a group.
```js
await ad.group('HR').removeUser('bjones');
// => {success: true}
```
#### ad.group(groupName).remove()
Deletes a group.
```js
await ad.group('HR').remove();
// => {success: true}
```
### Organizational Unit (OU) Methods
#### ad.ou().get(filter)
Returns all ou objects.
```js
await ad.ou().get();
// => [{ ... }, { ... }];
```
#### ad.ou().add(options)
Creates a new Organizational Unit. Returns the created OU object.
##### Options:
* `name`: String (required)
* `location`: String
* `description`: String
```js
await ad.ou().add({
name: 'Sales'
location: 'Users'
description: 'Sales Users.'
});
// => {ou: 'Sales' ... }
```
#### ad.ou(ouName).get(filter)
Returns an OU object. If no OU is matched, returns `undefined`.
```js
await ad.ou('Sales').get();
// => {ou: 'Sales', description: 'Sales...' ... }
```
#### ad.ou(ouName).exists()
Returns a `Boolean` of whether the OU exists.
```js
await ad.ou('Sales').exists();
// => true
```
#### ad.user(userName).remove()
Deletes an Organizational Unit. As a note, if it has any children, this will not work.
```js
await ad.ou('Sales').remove();
// => {success: true}
```
### Other methods
#### ad.other().get(filter)
Returns all objects that are not users or groups.
```js
await ad.other().get();
// => [{ ... }, { ... }];
```
#### ad.all().get(filter)
Returns all objects in the Active Directory instance, grouping by `users`, `groups` and `other`.
```js
await ad.other().get();
// => [users: [...], groups: [...], other: [...]];
```
#### ad.find(searchString)
Returns a raw search of the entire Active Directory.
```js
await ad.search('CN=Da*');
// => [{...}, {...}];
```
### Caching
#### ad.cache(boolean)
Enables or disables caching. Defaults to `true`.
```js
ad.cache(false);
```
#### ad.cacheTimeout(millis)
Sets the amount of milliseconds before a cached item expires. Defaults to ten minutes. Chainable to `ad.cache`.
```js
ad.cache(true).cacheTimeout(60000);
```
## Why?

@@ -352,3 +560,3 @@

Should you really have to know that `cn` stands for `Common Name` (or was is `Canonical`) in order to use it? Or that `sn` is a `surname`? I dislike systems that require detailed knowledge of their dirty laundry to do anything with them.
Should you really have to know that `cn` stands for `Common Name` (or was it `Canonical`) in order to use it? Or that `sn` is a `surname`*? I dislike systems that require detailed knowledge of their dirty laundry to do anything with them.

@@ -359,4 +567,6 @@ So this was a selfish project, really.

_*last name_
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc