Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

program transfer only to PD #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 10 additions & 25 deletions module/assets/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,6 @@ module.exports = class AssetsHelper {
: (updateUserAssetDataResult = false);
}
if (
reqData.toUserProfile.roles.includes(
constants.common.PROGRAM_MANAGER
) ||
reqData.toUserProfile.roles.includes(
constants.common.PROGRAM_DESIGNER
)
Expand Down Expand Up @@ -398,12 +395,9 @@ module.exports = class AssetsHelper {
: (updateUserAssetDataResult = false);
}
if (
(reqData.toUserProfile.roles.includes(
constants.common.PROGRAM_MANAGER
) ||
reqData.toUserProfile.roles.includes(
constants.common.PROGRAM_DESIGNER
)) &&
reqData.toUserProfile.roles.includes(
constants.common.PROGRAM_DESIGNER
) &&
assetTypeToTransfer === constants.common.PROGRAM
) {
//get from and to user details from userExtension collection
Expand Down Expand Up @@ -690,11 +684,8 @@ module.exports = class AssetsHelper {
fromUserData.platformRoles.forEach(async (role) => {
//user Role code of fromUser
let userRole = role.code;
// Loop only when UserRole is PM or PD instead of looping through all the roles
if (
userRole === constants.common.PROGRAM_MANAGER ||
userRole === constants.common.PROGRAM_DESIGNER
) {
// Loop only when UserRole is PD instead of looping through all the roles
if (userRole === constants.common.PROGRAM_DESIGNER) {
// Check if user Role already exists in userExtension collection or not
let toUserRoleExists = toUserData.platformRoles.some(
(toRole) => toRole.code === userRole
Expand Down Expand Up @@ -851,7 +842,8 @@ module.exports = class AssetsHelper {
* @name getPlatformRolesToTransfer
* @param {Array} fromUserPlatformRoleData - fromUser's platformRoles array data .
* @param {String} userRoleData - UserRole's Data.
* @param {Array} [reqData={}] - request body Data.
* @param {Array} [reqData={}] - userRole === constants.common.PROGRAM_MANAGER ||
request body Data.
* @param {boolean} [hasAssetInformation=false] - check asset information
* @returns {Promise<Array>} -Returns Array of platform roles.
*/
Expand All @@ -867,11 +859,8 @@ module.exports = class AssetsHelper {
let platformRoles = [];

for (let eachRole of fromUserPlatformRoleData) {
// Loop only when UserRole is PM or PD instead of looping through all the roles
if (
eachRole.code === constants.common.PROGRAM_MANAGER ||
eachRole.code === constants.common.PROGRAM_DESIGNER
) {
// Loop only when UserRole is PD instead of looping through all the roles
if (eachRole.code === constants.common.PROGRAM_DESIGNER) {
let matchingRole = userRoleData.find(
(role) => role.code === eachRole.code
);
Expand Down Expand Up @@ -939,15 +928,11 @@ module.exports = class AssetsHelper {
let rolesToCheck = [];
switch (assetsType) {
case constants.common.PROGRAM:
rolesToCheck = [
constants.common.PROGRAM_MANAGER,
constants.common.PROGRAM_DESIGNER,
];
rolesToCheck = [constants.common.PROGRAM_DESIGNER];
case constants.common.SOULTION:
rolesToCheck = [constants.common.CONTENT_CREATOR];
default:
rolesToCheck = [
constants.common.PROGRAM_MANAGER,
constants.common.PROGRAM_DESIGNER,
constants.common.CONTENT_CREATOR,
];
Expand Down