Skip to content

Commit

Permalink
Initial work
Browse files Browse the repository at this point in the history
  • Loading branch information
denizariyan committed Oct 2, 2020
1 parent 9a83c40 commit 0f64ae7
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var platform = require("os").platform();

function _check() {
return new Promise(resolve => {
if (platform == "win32" || platform == "win64") {
require('child_process').exec('net session', function (err, stdout, stderr) {
if (err) {
resolve(false);
} else {
resolve(true);
}
});
} else {
throw new Error('Can not determine if admin priviliges are present or not')
}
});
}


exports.check = async function () {
var result = await _check();
return result

}
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "admin-check",
"version": "1.1.0",
"description": "package to check if the script is runnig with admin permissions",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/denizariyan/admin-check.git"
},
"keywords": [
"admin",
"permission",
"check",
"is-admin",
"administrator"
],
"author": "denizariyan",
"license": "MIT",
"bugs": {
"url": "https://github.com/denizariyan/admin-check/issues"
},
"homepage": "https://github.com/denizariyan/admin-check#readme"
}

0 comments on commit 0f64ae7

Please sign in to comment.