New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/authorize

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/authorize - npm Package Compare versions

Comparing version 1.11.0 to 1.12.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.12.0](https://github.com/CoCreate-app/CoCreate-authorize/compare/v1.11.0...v1.12.0) (2023-12-21)
### Features
* use dotNotation for merging keys ([ac1177a](https://github.com/CoCreate-app/CoCreate-authorize/commit/ac1177a7445060ab679a3922bbfe544c11d807dc))
# [1.11.0](https://github.com/CoCreate-app/CoCreate-authorize/compare/v1.10.0...v1.11.0) (2023-11-25)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@cocreate/authorize",
"version": "1.11.0",
"version": "1.12.0",
"description": "A simple authorize component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -112,3 +112,5 @@ (function (root, factory) {

authorization = await createAuthorization(authorization, roles)
for (let role of roles) {
authorization = dotNotationToObject(authorization, role)
}
}

@@ -125,37 +127,2 @@ return authorization;

async function createAuthorization(authorization, roles) {
roles.map(role => {
for (const roleKey in role) {
if (!["_id", "type", "name", "organization_id"].includes(roleKey)) {
if (!authorization[roleKey]) {
authorization[roleKey] = role[roleKey]
} else {
if (Array.isArray(role[roleKey])) {
for (let item of role[roleKey]) {
if (!authorization[roleKey].includes(item))
authorization[roleKey].push(item)
}
}
else if (typeof role[roleKey] == 'object') {
for (const c of Object.keys(role[roleKey])) {
if (!authorization[roleKey][c]) {
authorization[roleKey][c] = role[roleKey][c]
} else {
if (typeof role[roleKey][c] == 'object') {
authorization[roleKey][c] = { ...authorization[roleKey][c], ...role[roleKey][c] }
} else {
authorization[roleKey][c] = role[roleKey][c]
}
}
}
} else {
authorization[roleKey] = role[roleKey]
}
}
}
}
})
return authorization;
}
async function check(data, user_id) {

@@ -282,2 +249,13 @@ let authorization = false

} else {
if (key === '$array' && value === 'questions') {
if (typeof data.array === 'string') {
if (typeof value === 'string') {
return data.array === value
} else if (Array.isArray(value)) {
return value.includes(data.array)
}
} else if (Array.isArray(data.array)) {
}
}
// TODO: sanitize data by removing items user does not have access to.

@@ -284,0 +262,0 @@ // console.log('key is a query operator', key)

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