UNPKG

node-expose-sspi-strict

Version:

Expose the Microsoft Windows SSPI interface in order to do NTLM and Kerberos authentication.

26 lines (25 loc) 816 B
"use strict"; exports.__esModule = true; exports.hasAdminPrivileges = void 0; var __1 = require(".."); /** * Test if the current user token has admin privileges. * * If this function return false, it means that operations that * requires admin rights cannot be done, even if the account is * configured with admin right. Functions that require admin right * would return the error 5 (admin right required). * * Example: `netapi.NetUserAdd` function can be called only * if the user token has admin privilege. * * @export * @returns {boolean} */ function hasAdminPrivileges() { var sid = __1.sspi.AllocateAndInitializeSid(); var result = __1.sspi.CheckTokenMembership(sid); __1.sspi.FreeSid(sid); return result; } exports.hasAdminPrivileges = hasAdminPrivileges;