npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

atlassian-crowd-client

v2.0.0

Published

Atlassian Crowd API client for Node

Downloads

1,860

Readme

npm version

atlassian-crowd-client

Promise-based client library to communicate with an Atlassian Crowd server from Node, written in ES6. This uses the Crowd REST APIs.

Installation

npm install --save atlassian-crowd-client

Usage

var CrowdClient = require('atlassian-crowd-client');
var User = require('atlassian-crowd-client/lib/models/user');

// Initialize the Crowd client:
var crowd = new CrowdClient({
  baseUrl: 'https://crowd.example.com/',
  application: {
    name: 'demo',
    password: 'example'
  }
});

// Create a new user:
crowd.user.create(new User('John', 'Doe', 'John Doe', '[email protected]', 'johndoe', 'secret'));

// Authenticate to Crowd:
crowd.session.create('someusername', 'somepassword').then(function (session) {

  // Fetch the user profile:
  crowd.session.getUser(session.token).then(function (user) {
    console.log('Hello, ' + user.displayname);
  });
});

// Find all active groups (using Crowd Query Language):
crowd.search.group('active=true').then(function (groups) {
  console.log('Found groups: ' + groups.length);
});

Configuration

Refer to the example settings file for all configurable options.

API

The package provides two main classes: CrowdApi and CrowdClient.

The CrowdApi class implements a generic interface to make HTTP requests to the Crowd REST API. It ensures that the appropriate headers are used and errors are handled. It also wraps the callbacks in promises.

The CrowdClient class makes all Crowd REST Resources and their variants/options available as convenient JavaScript methods. Each method provides sensible defaults and maps responses to common domain objects.

Domain model objects

In order to provide a consistent API, most CrowdClient methods map Crowd API responses to domain objects. Many parameters are also expected to be a domain object. Here's an overview of the domain models and their properties:

Session

  • token (string): Session token as generated by Crowd.
  • createdAt (Date): Creation date/time of the session token.
  • expiresAt (Date): Expiration date/time of the session token.

Group

  • groupname (string): Name of the group.
  • description (string): Description for the group.
  • active (boolean): Whether the group is active or not.

User

  • firstname (string): First name.
  • lastname (string): Last name.
  • displayname (string): Display name (i.e. full name).
  • email (string): Email address.
  • username (string): Username (i.e. login name).
  • password (string): Password, only used when creating a new user, never returned by Crowd.
  • active (boolean): Whether the user is active or not.

Attributes

  • attributes (object): User/Group attributes as key-value pairs.

ValidationFactors

  • validationFactors (object): Validation factors as key-value pairs.

Development

The library is completely written in ES6, using babel-node to run tests. Source code is compiled to ES5 before publication to NPM, so the library can also be used in ES5 projects.

Included are integration tests to verify proper functioning of all endpoints. For this you will need to provide settings for a Crowd test server, since the integration tests will make actual HTTP requests. An example settings file is provided at test/helpers/settings-example.js. Copy or rename it to settings.js and provide your own configuration.

git clone https://github.com/wehkamp/atlassian-crowd-client.git
cd atlassian-crowd-client
cp test/helpers/settings-example.js test/helpers/settings.js
npm install
npm test