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

@live-change/access-control-service

Package Overview
Dependencies
Maintainers
0
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@live-change/access-control-service - npm Package Compare versions

Comparing version 0.8.121 to 0.8.122

90

invite.js

@@ -276,3 +276,3 @@ import App from '@live-change/framework'

visibilityTest || access.clientCanInvite(client, params),
async execute(params, { client, service, trigger }, emit) {
async execute(params, { client, service, trigger }, emit) {
const { [contactTypeName]: contact } = params

@@ -319,3 +319,3 @@ const { objectType, object } = params

maxRetries: 1,
async execute(params, { service, task }, emit) {
async execute(params, { service, task, trigger }, emit) {
const { [contactTypeName]: contact } = params

@@ -326,2 +326,3 @@ const { objectType, object } = params

const invitationData = { fromType, from, roles }
for(const propertyName in invitationProperties) invitationData[propertyName] = params[propertyName]
return await doInvite(contact, objectType, object, invitationData, emit, trigger)

@@ -359,11 +360,12 @@ }

},
async execute(params, { service, task }, emit) {
const { objectType, object } = params
const { roles } = params
const { fromType, from } = params
const invitationData = { fromType, from, roles }
for(const propertyName in invitationProperties) invitationData[propertyName] = params[propertyName]
for(const contact of params.contacts) {
async execute(params, { service, task, trigger }, emit) {
const contactsCount = params.contacts.length
for(let i = 0; i < contactsCount; i++) {
task.progress(i, contactsCount, 'inviting')
const contact = params.contacts[i]
try {
await doInvite(contact[contactTypeName], objectType, object, invitationData, emit, trigger)
task.run(inviteOneTask, {
...params,
...contact
})
} catch(e) {

@@ -373,2 +375,3 @@ // ignore errors

}
task.progress(contactsCount, contactsCount, 'done')
}

@@ -391,2 +394,3 @@ }, definition)

contacts: {
validation: ['nonEmpty'],
type: Array,

@@ -402,3 +406,2 @@ of: {

async execute(params, { client, service, trigger, command }, emit) {
const { [contactTypeName]: contact } = params
const { objectType, object } = params

@@ -415,3 +418,3 @@

await inviteManyTask.start({
return await inviteManyTask.start({
...params,

@@ -425,2 +428,65 @@ fromType, from,

definition.action({
name: 'inviteMany' + pluralize(contactTypeUpperCaseName) + 'FromText',
waitForEvents: true,
properties: {
objectType: {
type: String,
validation: ['nonEmpty']
},
object: {
type: String,
validation: ['nonEmpty']
},
...invitationProperties,
[pluralize(contactTypeName) + 'Text']: {
type: String,
validation: ['nonEmpty']
}
},
access: (params, { client, context, visibilityTest}) =>
visibilityTest || access.clientCanInvite(client, params),
async execute(params, { client, service, trigger, command }, emit) {
const fieldName = pluralize(contactTypeName) + 'Text'
const contacts = params[fieldName].split(/[,;\n]/).map(line => {
const parts = line.split('\t')
return parts[0].trim()
}).filter(x => !!x).map(contact => ({ [contactTypeName]: contact }))
if(contacts.length === 0) throw {
properties: { [fieldName]: 'empty' }
}
for(const contact of contacts) {
console.log("C", contact)
const error = service.definition.validators[contactTypeName]()(contact[contactTypeName], {
source: { properties: { [fieldName]: contact[contactTypeName] } }
})
if(error) throw {
properties: { [fieldName]: error }
}
}
const { objectType, object } = params
const myRoles = await access.getClientObjectRoles(
client, { objectType, object }, true
)
if(!myRoles.includes('admin')) {
for(const requestedRole of roles) {
if(!myRoles.includes(requestedRole)) throw 'notAuthorized'
}
}
const [ fromType, from ] = client.user ? ['user_User', client.user] : ['session_Session', client.session]
return await inviteManyTask.start({
...params,
fromType, from,
ownerType: objectType,
owner: object,
contacts
}, 'action', command.id )
}
})
}

6

package.json
{
"name": "@live-change/access-control-service",
"version": "0.8.121",
"version": "0.8.122",
"description": "",

@@ -24,6 +24,6 @@ "main": "index.js",

"dependencies": {
"@live-change/framework": "^0.8.121"
"@live-change/framework": "^0.8.122"
},
"gitHead": "2fd79c450701fcfe3f69fa92276efd351eb57580",
"gitHead": "3d1935bdc16579c96f009d49f1e9aa70a7697c71",
"type": "module"
}
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