Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stamhoofd/structures

Package Overview
Dependencies
Maintainers
1
Versions
275
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stamhoofd/structures - npm Package Compare versions

Comparing version 1.4.10 to 1.4.11

1

dist/src/Permissions.d.ts

@@ -27,2 +27,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding';

groups: GroupPermissions[];
hasAccess(level: PermissionLevel, groupId?: string | null): boolean;
hasReadAccess(groupId?: string | null): boolean;

@@ -29,0 +30,0 @@ hasWriteAccess(groupId?: string | null): boolean;

45

dist/src/Permissions.js

@@ -44,21 +44,9 @@ "use strict";

}
hasReadAccess(groupId = null) {
if (this.level != PermissionLevel.None) {
// Has read access
return true;
}
if (!groupId) {
hasAccess(level, groupId = null) {
if (level == PermissionLevel.None) {
// none means, none, even not none.
return false;
}
const permission = this.groups.find(g => g.groupId === groupId);
if (permission) {
if (permission.level != PermissionLevel.None) {
return true;
}
}
return false;
}
hasWriteAccess(groupId = null) {
if (this.level == PermissionLevel.Write || this.level == PermissionLevel.Full) {
// Has read access
if (getPermissionLevelNumber(this.level) >= getPermissionLevelNumber(level)) {
// Someone with read / write access for the whole organization, also the same access for each group
return true;

@@ -71,3 +59,3 @@ }

if (permission) {
if (permission.level == PermissionLevel.Write || permission.level == PermissionLevel.Full) {
if (getPermissionLevelNumber(permission.level) >= getPermissionLevelNumber(level)) {
return true;

@@ -78,17 +66,10 @@ }

}
hasReadAccess(groupId = null) {
return this.hasAccess(PermissionLevel.Read, groupId);
}
hasWriteAccess(groupId = null) {
return this.hasAccess(PermissionLevel.Write, groupId);
}
hasFullAccess(groupId = null) {
if (this.level == PermissionLevel.Full) {
// Has read access
return true;
}
if (!groupId) {
return false;
}
const permission = this.groups.find(g => g.groupId === groupId);
if (permission) {
if (permission.level == PermissionLevel.Full) {
return true;
}
}
return false;
return this.hasAccess(PermissionLevel.Full, groupId);
}

@@ -95,0 +76,0 @@ }

@@ -27,2 +27,3 @@ import { AutoEncoder } from '@simonbackx/simple-encoding';

groups: GroupPermissions[];
hasAccess(level: PermissionLevel, groupId?: string | null): boolean;
hasReadAccess(groupId?: string | null): boolean;

@@ -29,0 +30,0 @@ hasWriteAccess(groupId?: string | null): boolean;

@@ -39,21 +39,9 @@ import { __decorate } from "tslib";

}
hasReadAccess(groupId = null) {
if (this.level != PermissionLevel.None) {
// Has read access
return true;
}
if (!groupId) {
hasAccess(level, groupId = null) {
if (level == PermissionLevel.None) {
// none means, none, even not none.
return false;
}
const permission = this.groups.find(g => g.groupId === groupId);
if (permission) {
if (permission.level != PermissionLevel.None) {
return true;
}
}
return false;
}
hasWriteAccess(groupId = null) {
if (this.level == PermissionLevel.Write || this.level == PermissionLevel.Full) {
// Has read access
if (getPermissionLevelNumber(this.level) >= getPermissionLevelNumber(level)) {
// Someone with read / write access for the whole organization, also the same access for each group
return true;

@@ -66,3 +54,3 @@ }

if (permission) {
if (permission.level == PermissionLevel.Write || permission.level == PermissionLevel.Full) {
if (getPermissionLevelNumber(permission.level) >= getPermissionLevelNumber(level)) {
return true;

@@ -73,17 +61,10 @@ }

}
hasReadAccess(groupId = null) {
return this.hasAccess(PermissionLevel.Read, groupId);
}
hasWriteAccess(groupId = null) {
return this.hasAccess(PermissionLevel.Write, groupId);
}
hasFullAccess(groupId = null) {
if (this.level == PermissionLevel.Full) {
// Has read access
return true;
}
if (!groupId) {
return false;
}
const permission = this.groups.find(g => g.groupId === groupId);
if (permission) {
if (permission.level == PermissionLevel.Full) {
return true;
}
}
return false;
return this.hasAccess(PermissionLevel.Full, groupId);
}

@@ -90,0 +71,0 @@ }

{
"name": "@stamhoofd/structures",
"version": "1.4.10",
"version": "1.4.11",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "module": "./esm/dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc