Commit 553a95ac authored by Sang D NGO's avatar Sang D NGO

expert can see only proposal reviewed by them

parent 702bdf6e
......@@ -29,6 +29,10 @@ module.exports = function(dependencies) {
query.creator = options.creator;
}
if (options.reviewer) {
query.reviewers = options.reviewer;
}
if (options.status) {
query.status = options.status;
}
......
......@@ -38,6 +38,7 @@ module.exports = function(dependencies, lib) {
function getProposals(req, res) {
var listOptions = {
creator: req.query.creator,
reviewer: req.query.reviewer,
type: req.query.type,
status: req.query.status,
limit: Number(req.query.limit),
......
......@@ -8,6 +8,7 @@
function mostProposalApiClient(
session,
mostRoleService,
mostRestangular
) {
return {
......@@ -22,8 +23,12 @@
}
function getProposals(options) {
if (!session.userIsDomainAdministrator()) {
var userRole = mostRoleService.getRole();
if (userRole === 'user') {
options.creator = session.user._id;
} else if (userRole === 'expert') {
options.reviewer = session.user._id;
}
return mostRestangular.all(API_PATH).getList(options).then(_stripAndReturnData).then(function(proposals) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment