1.0.4 • Published 6 years ago

isprivileged v1.0.4

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago

isPrivileged

A simple utility to check for root or admin rights in native nodeJs


ReleaseDoc StatusCurrent Version
DevelopmentFirst Release - Stablev1.1.0

Dependency Status Build Status GitHub issues GitHub stars GitHub license


Features

  • Cross Os Compatibility
  • Automatically detects the user platform to distinguish between linux or windows
  • Simple to load and install
  • Relies only on NodeJs built in modules except for testing

Installation

Installation is simple.

For use in an existing project

npm install --save isPrivileged

To Contribute

// Clone the repo
git clone https://github.com/JasonDemitri/isPrivileged.git

// Change to the project
cd isPrivileged/

// Install Testing Deps
npm install

Usage

Using isPrivileged is also simple

Include the module in your project and then simply call the funtion making sure to include a callback. The call back will either be clean/null for root/admin or throw an error if not

var isPriv = require('isprivileged');

isPriv(function(err){
    if(err){ 
        // NO ROOT/ADMIN - EXIT/DONT RUN
        new Error(err);
    }else{
        // ROOT/ADMIN - CONTINUE
    }
});

Directory Structure

Not much explaining needed however for those interested...

./ROOT
    /libs // Holds the library
        /index.js // Holds our main export function
    /node_modules
        /.. // Dependencies will be in here
    /test // All our tests are here
        /test.js // Holds the main testsuit

Support / Contributing

Support is limited due to this being such a small helper function.

Any issues, bugs or requests please use github issues.

Versioning

isPrivileged works using semver style versioning heres a quick guide

A version number consists of 3 parts

// Major // Minor // Patch
v    1   .    0   .     1
  • A new Major version indicates new features or code edits that will most likely have a major impact to the original code base.
  • A new Minor version usually included new features, updates and fixes that could have a minor impact into the existing code base.
  • A new Patch version usually includes bug/issue fixes, minor refractors or ammendments and should have no effect little or no impact on the codebase.

Release History

  • v1.0.0 | Initial Release
  • v1.0.1 | Additional docs and testing
  • v1.0.2 | Added aditional testing setup
  • v1.0.3 | Removed travisCI for the momment and updated docs

License

The MIT License (MIT)

Copyright (c) 2017 Jay Demitri | London Development Studio

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.

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago