@squared-functions/core
Advanced tools
Comparing version 3.1.5 to 3.2.0
39
index.js
@@ -1,2 +0,2 @@ | ||
/* @squared-functions/core 3.1.5 | ||
/* @squared-functions/core 3.2.0 | ||
https://github.com/anpham6/squared-functions */ | ||
@@ -7,4 +7,7 @@ | ||
exports.Module = exports.Host = void 0; | ||
const types_1 = require("../types"); | ||
const module_1 = require("../module"); | ||
exports.Module = module_1.default; | ||
const permission_1 = require("../file-manager/permission"); | ||
let PERMISSION = null; | ||
class Host extends module_1.default { | ||
@@ -17,2 +20,35 @@ constructor() { | ||
} | ||
static loadSettings(settings, permission) { | ||
super.loadSettings(settings); | ||
if (permission && (0, types_1.isPlainObject)(settings.permission)) { | ||
const { disk_read, disk_write, unc_read, unc_write } = settings.permission; | ||
PERMISSION = new permission_1.default(); | ||
if (permission.disk_read) { | ||
PERMISSION.setDiskRead(disk_read); | ||
} | ||
if (permission.disk_write) { | ||
PERMISSION.setDiskWrite(disk_write); | ||
} | ||
if (permission.unc_read) { | ||
PERMISSION.setUNCRead(unc_read); | ||
} | ||
if (permission.unc_write) { | ||
PERMISSION.setUNCWrite(unc_write); | ||
} | ||
Object.freeze(PERMISSION); | ||
} | ||
} | ||
static createPermission(accessAll) { | ||
const permission = new permission_1.default(); | ||
if (accessAll) { | ||
permission.setDiskRead('**'); | ||
permission.setDiskWrite('**'); | ||
permission.setUNCRead('**'); | ||
permission.setUNCWrite('**'); | ||
} | ||
return permission; | ||
} | ||
static getPermissionFromSettings() { | ||
return PERMISSION; | ||
} | ||
restart(...args) { } | ||
@@ -73,2 +109,3 @@ find(name) { | ||
exports.Host = Host; | ||
Object.freeze(PERMISSION = Host.createPermission(true)); | ||
if (typeof module !== 'undefined') { | ||
@@ -75,0 +112,0 @@ module.exports = { Module: module_1.default, Host }; |
{ | ||
"name": "@squared-functions/core", | ||
"version": "3.1.5", | ||
"version": "3.2.0", | ||
"description": "Core modules for squared-functions", | ||
@@ -18,6 +18,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"@squared-functions/module": "3.1.5", | ||
"@squared-functions/types": "3.1.5", | ||
"@squared-functions/module": "3.2.0", | ||
"@squared-functions/types": "3.2.0", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5574
115
+ Added@squared-functions/module@3.2.0(transitive)
+ Added@squared-functions/types@3.2.0(transitive)
- Removed@squared-functions/module@3.1.5(transitive)
- Removed@squared-functions/types@3.1.5(transitive)