-
Notifications
You must be signed in to change notification settings - Fork 20
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
External mentee visibility policy #625
base: develop
Are you sure you want to change the base?
Conversation
…xternal-mentee-visibility-policy
12d7ec7
to
dffdad7
Compare
@@ -110,6 +110,7 @@ module.exports = class Mentees { | |||
try { | |||
const filterList = await menteesService.getFilterList( | |||
req.query.entity_types ? req.query.entity_types : '', | |||
req.query.filter_type ? req.query.filter_type : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not come in your PR.
Please fetch the latest pull and correct this
throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') | ||
} | ||
let res = await queryInterface.bulkUpdate( | ||
'forms', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this migration.
Not needed in this PR
external_mentee_visibility: { | ||
type: DataTypes.STRING, | ||
defaultValue: 'CURRENT', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs , Check if we need mentee_visibility_policy here
external_mentee_visibility: { | ||
type: DataTypes.STRING, | ||
defaultValue: 'CURRENT', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs Check if we need mentee_visibility_policy here
@@ -65,9 +65,10 @@ | |||
"FORM_VERSION_FETCHED_SUCCESSFULLY": "Form versions fetched successfully", | |||
"ACCESS_TOKEN_EXPIRED": "Session expired. Please login again.", | |||
"INVALID_TIME_SELECTION": "You already have a session '{{sessionName}}' scheduled at this time. Please select a different time.", | |||
"SESSION_DELETION_FAILED": "Session can't be deleted", | |||
"CANNOT_DELETE_LIVE_SESSION": "Cannot delete ongoing session.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if this change is necessary in this PR
@Prajwal17Tunerlabs
…xternal-mentee-visibility-policy
try { | ||
let organization_ids = [] | ||
|
||
const attributes = | ||
filter_type.toLowerCase() == common.MENTEE_ROLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs do check with mentor role
} | ||
) | ||
|
||
const visibilityPolicy = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs same check is happening two times, remove one of them, and check with mentor role
organization_ids.push(...relatedOrgs) | ||
} else { | ||
const filterQuery = | ||
filter_type.toLowerCase() == common.MENTEE_ROLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs check with mentor role
|
||
// Filter user data based on policy | ||
// generate filter based on condition | ||
if (externalVisibilityPolicy === common.CURRENT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs No need to rewrite the existing code. Please use the same variable
/** | ||
* If user external_mentor_visibility is associated | ||
* <<point**>> first we need to check if mentor's visible_to_organizations contain the user organization_id and verify mentor's visibility is not current (if it is ALL and ASSOCIATED it is accessible) | ||
*/ | ||
filter = | ||
additionalFilter + | ||
`AND ( (${userPolicyDetails.organization_id} = ANY("visible_to_organizations") AND "visibility" != 'CURRENT')` | ||
`AND ( (${userPolicyDetails.organization_id} = ANY("visible_to_organizations") AND "external_mentee_visibility_policy" != 'CURRENT')` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs why we checking external_mentee_visibility_policy instead of visibility?
/** | ||
* We need to check if mentor's visible_to_organizations contain the user organization_id and verify mentor's visibility is not current (if it is ALL and ASSOCIATED it is accessible) | ||
* OR if mentor visibility is ALL that mentor is also accessible | ||
*/ | ||
filter = | ||
additionalFilter + | ||
`AND ((${userPolicyDetails.organization_id} = ANY("visible_to_organizations") AND "visibility" != 'CURRENT' ) OR "visibility" = 'ALL' OR "organization_id" = ${userPolicyDetails.organization_id})` | ||
`AND ((${userPolicyDetails.organization_id} = ANY("visible_to_organizations") AND "external_mentee_visibility_policy" != 'CURRENT' ) OR "external_mentee_visibility_policy" = 'ALL' OR "organization_id" = ${userPolicyDetails.organization_id})` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs why we checking external_mentee_visibility_policy instead of visibility?
@@ -364,6 +364,8 @@ module.exports = class MentorsHelper { | |||
...data, | |||
...saasPolicyData, | |||
visible_to_organizations: userOrgDetails.data.result.related_orgs, | |||
visibility: organisationPolicy.mentee_visibility_policy, | |||
external_mentee_visibility: organisationPolicy.external_mentee_visibility_policy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Prajwal17Tunerlabs this function creates mentor extension then why external_mentee_visibility is required here ?
No description provided.