Skip to content

Commit

Permalink
Fixed all tests for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
nikordaris committed Feb 24, 2016
0 parents commit aba292c
Show file tree
Hide file tree
Showing 8 changed files with 487 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/*
.DS_Store
*~
.idea/
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
sudo: false

node_js:
- '0.10'
- '0.12'
- 'stable'

before_install:
- sh arangodb.sh
64 changes: 64 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#NODE ACL - ArangoDB backend
This fork adds ArangoDB backend support to [NODE ACL](https://github.com/OptimalBits/node_acl)

##Installation

Using npm:

```javascript
npm install acl-arangodb
```

##Usage
Download and install [ArangoDB](https://www.arangodb.com/)
Start ArangoDB with default configuration.
Create ArangoDB database object in your node.js application.
Create acl module and instantiate it with ArangoDB backend, passing the ArangoDB object into the backend instance.

```javascript
// require arangojs
var arangojs = require('arangojs');
// Defaults to localhost and '_system' database. See arangojs documentation for configuration options
var db = arangojs();
// Set the database for your ACL. Note: You must create the database if it doesn't exist already.
db.useDatabase('mydb');

// require acl and create ArangoDB backend
var Acl = require('acl');
// Doesn't set a 'prefix' for collections and separates buckets into multiple collections.
acl = new Acl(new Acl.arangodbBackend(db));

// Alternatively, set a prefix and combined buckets into a single collection
acl = new Acl(new Acl.arangodbBackend(db, 'acl_', true));
```
##Testing
Tested using acl's tests runner against ArangoDB v2.8.2

##Documentation
See [NODE ACL documentation](https://github.com/OptimalBits/node_acl#documentation)
See [ArangoDB documentation](https://docs.arangodb.com)

##License

(The MIT License)

Copyright (c) 2016 Nick Harris <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 changes: 41 additions & 0 deletions arangodb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR

VERSION=2.8.2
NAME=ArangoDB-$VERSION

if [ ! -d "$DIR/$NAME" ]; then
# download ArangoDB
wget http://www.arangodb.org/travisCI/$NAME.tar.gz
tar zxf $NAME.tar.gz
fi

PID=$(echo $PPID)
TMP_DIR="/tmp/arangodb.$PID"
PID_FILE="/tmp/arangodb.$PID.pid"
ARANGODB_DIR="$DIR/$NAME"

# create database directory
mkdir ${TMP_DIR}

${ARANGODB_DIR}/bin/arangod \
--database.directory ${TMP_DIR} \
--configuration none \
--server.endpoint tcp://127.0.0.1:8529 \
--javascript.startup-directory ${ARANGODB_DIR}/js \
--javascript.modules-path ${ARANGODB_DIR}/js/server/modules:${ARANGODB_DIR}/js/common/modules \
--javascript.action-directory ${ARANGODB_DIR}/js/actions/system \
--database.maximal-journal-size 1048576 \
--server.disable-admin-interface true \
--server.disable-authentication true \
--javascript.gc-interval 1 &

echo "Waiting until ArangoDB is ready on port 8529"
while [[ -z `curl -s 'http://127.0.0.1:8529/_api/version' ` ]] ; do
echo -n "."
sleep 2s
done

echo "ArangoDB is up"
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = require('acl');

module.exports.__defineGetter__('arangodbBackend', function(){
return require('./lib/arangodb-backend.js');
});
Loading

0 comments on commit aba292c

Please sign in to comment.