-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added update restrictions, techStacks in project and orgId to a user * added edit restriction mechanism * intial deactivation mechanism * intial logging mechanism and deactive account * issue fix * fixing org creation issue * Fixes issues in testing (#160) * fix failing test file user.test.js * fixes EADDRINUSE while testing * fixes issues in prposal route * fixed issues in org route and added new tests * Moving Google Analytics requests to backend (#154) * Moving Google Analytics requetss to backend * Requested Changes * Minor changes * Adding code to prevent attacks (#153) * modified user's api (#168) * modified user's api * login options during login * Changes for reactions (#166) * Revert "Adding code to prevent attacks (#153)" (#170) This reverts commit 57a0cf9. * Fixed and written all the missing test cases (#172) * update code * fixed failing test cases and missing test cases * User activity tracker using redis (#174) * update code * initial mechanism for user tracking initial mechanism for user tracking * Security issue (#177) * update code * fix security flaws * fixed test cases * minor fixes (#178) * add docs for new contributors (#181) Co-authored-by: Devesh Verma <[email protected]> Co-authored-by: Kumar Saurabh Raj <[email protected]> Co-authored-by: Asel Peiris <[email protected]> Co-authored-by: pranjals149 <[email protected]> Co-authored-by: Vaibhav D. Aren <[email protected]>
- Loading branch information
1 parent
940a3fa
commit fed0e63
Showing
33 changed files
with
993 additions
and
256 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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const User = require('../models/User') | ||
const Activity = require('../models/Activity') | ||
|
||
const HttpStatus = require('http-status-codes') | ||
module.exports = { | ||
|
||
getActivity: async (req, res, next) => { | ||
// userID whose activity will be fetched by admin | ||
const { id } = req.params | ||
|
||
try { | ||
// Check if user exists | ||
const user = await User.findById(req.user._id) | ||
if (!user) { | ||
return res.status(HttpStatus.BAD_REQUEST).json({ msg: 'No such user exists!' }) | ||
} | ||
|
||
// check if not admin | ||
if (user.isAdmin !== true) { | ||
return res.status(HttpStatus.BAD_REQUEST).json({ msg: 'You don\'t have permission!' }) | ||
} | ||
|
||
const data = await Activity.findOne({ userId: id }) | ||
return res.status(HttpStatus.OK).json({ activity: data.activity }) | ||
} catch (error) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
console.log(error.name, '-', error.message) | ||
} | ||
return res.status(HttpStatus.BAD_REQUEST).json({ error: error.message }) | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.