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

@contember/schema-utils

Package Overview
Dependencies
Maintainers
5
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/schema-utils - npm Package Compare versions

Comparing version 0.11.1 to 0.11.2

9

dist/src/validation/AclValidator.js

@@ -43,3 +43,3 @@ "use strict";

// }
const rolePermissions = this.validateRolePermissions(roles[role], validRoles, errorBuilder.for(role));
const rolePermissions = this.validateRolePermissions(roles[role], Object.keys(roles), errorBuilder.for(role));
if (rolePermissions !== undefined) {

@@ -79,6 +79,5 @@ validRoles[role] = rolePermissions;

for (const inheritsFrom of inherits) {
if (!roles[inheritsFrom]) {
errorBuilder
.for(inheritsFrom)
.add('Referenced role not exists. Make sure you are defining roles in a right order');
if (!roles.includes(inheritsFrom)) {
// todo: check recursion
errorBuilder.for(inheritsFrom).add('Referenced role not exists.');
}

@@ -85,0 +84,0 @@ else {

{
"name": "@contember/schema-utils",
"version": "0.11.1",
"version": "0.11.2",
"license": "Apache-2.0",

@@ -11,3 +11,3 @@ "main": "dist/src/index.js",

"dependencies": {
"@contember/schema": "^0.11.1"
"@contember/schema": "^0.11.2"
},

@@ -14,0 +14,0 @@ "devDependencies": {

@@ -39,3 +39,3 @@ import { Acl, Model } from '@contember/schema'

// }
const rolePermissions = this.validateRolePermissions(roles[role], validRoles, errorBuilder.for(role))
const rolePermissions = this.validateRolePermissions(roles[role], Object.keys(roles), errorBuilder.for(role))
if (rolePermissions !== undefined) {

@@ -50,3 +50,3 @@ validRoles[role] = rolePermissions

permissions: unknown,
roles: Acl.Schema['roles'],
roles: string[],
errorBuilder: ErrorBuilder,

@@ -85,7 +85,3 @@ ): Acl.RolePermissions | undefined {

private validateInherits(
inherits: unknown,
roles: Acl.Schema['roles'],
errorBuilder: ErrorBuilder,
): string[] | undefined {
private validateInherits(inherits: unknown, roles: string[], errorBuilder: ErrorBuilder): string[] | undefined {
if (inherits === undefined) {

@@ -100,6 +96,5 @@ return undefined

for (const inheritsFrom of inherits) {
if (!roles[inheritsFrom]) {
errorBuilder
.for(inheritsFrom)
.add('Referenced role not exists. Make sure you are defining roles in a right order')
if (!roles.includes(inheritsFrom)) {
// todo: check recursion
errorBuilder.for(inheritsFrom).add('Referenced role not exists.')
} else {

@@ -106,0 +101,0 @@ validRoles.push(inheritsFrom)

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