-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #353 from hms-dbmi-cellenics/revert-346-cellsets-e…
…ndpoint-v2 Revert "[BIOMAGE-1878] - Add v2 cellsets endpoints"
- Loading branch information
Showing
37 changed files
with
60 additions
and
1,260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
const mockGetUserAccess = jest.fn(); | ||
const mockInviteUser = jest.fn(); | ||
const mockRevokeAccess = jest.fn(); | ||
const mockGetExperimentUsers = jest.fn(); | ||
|
||
module.exports = { | ||
getUserAccess: mockGetUserAccess, | ||
inviteUser: mockInviteUser, | ||
revokeAccess: mockRevokeAccess, | ||
getExperimentUsers: mockGetExperimentUsers, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,19 @@ | ||
const getExperimentUsers = require('../helpers/access/getExperimentUsers'); | ||
const createUserInvite = require('../helpers/access/createUserInvite'); | ||
const removeAccess = require('../helpers/access/removeAccess'); | ||
|
||
const OK = require('../../utils/responses/OK'); | ||
const getUserRoles = require('../helpers/access/getUserRoles'); | ||
const getLogger = require('../../utils/getLogger'); | ||
|
||
const logger = getLogger('[AccessController] - '); | ||
|
||
const getUserAccess = async (req, res) => { | ||
const getExperimentUsers = async (req, res) => { | ||
const { experimentId } = req.params; | ||
|
||
logger.log(`Fetching users for experiment ${experimentId}`); | ||
const users = await getExperimentUsers(experimentId); | ||
const users = await getUserRoles(experimentId); | ||
|
||
logger.log(`Users fetched for experiment ${experimentId}`); | ||
|
||
res.json(users); | ||
}; | ||
|
||
const inviteUser = async (req, res) => { | ||
const { experimentId } = req.params; | ||
const { | ||
userEmail, role, | ||
} = req.body; | ||
|
||
logger.log(`Inviting users to experiment ${experimentId}`); | ||
await createUserInvite(experimentId, userEmail, role, req.user); | ||
|
||
logger.log(`Users invited to experiment ${experimentId}`); | ||
|
||
res.json(OK()); | ||
}; | ||
|
||
const revokeAccess = async (req, res) => { | ||
const { experimentId } = req.params; | ||
const { userEmail } = req.body; | ||
|
||
logger.log(`Deleting user access from experiment ${experimentId}`); | ||
await removeAccess(experimentId, userEmail); | ||
|
||
logger.log(`User access deleted from experiment ${experimentId}`); | ||
|
||
res.json(OK()); | ||
}; | ||
|
||
module.exports = { | ||
getUserAccess, | ||
inviteUser, | ||
revokeAccess, | ||
getExperimentUsers, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,12 @@ | ||
const { | ||
getUserAccess, | ||
inviteUser, | ||
revokeAccess, | ||
getExperimentUsers, | ||
} = require('../controllers/accessController'); | ||
|
||
const { expressAuthorizationMiddleware } = require('../middlewares/authMiddlewares'); | ||
|
||
module.exports = { | ||
'access#getExperimentUsers': [ | ||
expressAuthorizationMiddleware, | ||
(req, res, next) => getUserAccess(req, res).catch(next), | ||
], | ||
'access#inviteUser': [ | ||
expressAuthorizationMiddleware, | ||
(req, res, next) => inviteUser(req, res).catch(next), | ||
], | ||
'access#revokeAccess': [ | ||
expressAuthorizationMiddleware, | ||
(req, res, next) => revokeAccess(req, res).catch(next), | ||
(req, res, next) => getExperimentUsers(req, res).catch(next), | ||
], | ||
}; |
Oops, something went wrong.