Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
fix(permissions): adds project owner to stream perms
Browse files Browse the repository at this point in the history
makes sure #118 doesn't happen

fixes #118
  • Loading branch information
didimitrie committed Dec 4, 2019
1 parent 779751b commit 51ddf13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/api/projects/ProjectPutAddStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ module.exports = async ( req, res ) => {
project.permissions.canRead.forEach( id => {
stream.canRead.indexOf( id ) === -1 ? stream.canRead.push( id ) : null
} )

stream.canRead.indexOf( project.owner ) === -1 ? stream.canRead.push( project.owner ) : null

project.permissions.canWrite.forEach( id => {
stream.canWrite.indexOf( id ) === -1 ? stream.canWrite.push( id ) : null
} )

stream.canWrite.indexOf( project.owner ) === -1 ? stream.canWrite.push( project.owner ) : null

await Promise.all( [ stream.save( ), project.save( ) ] )
return res.send( { success: true, project: project, stream: stream } )
} catch ( err ) {
Expand Down

0 comments on commit 51ddf13

Please sign in to comment.