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

External mentee visibility policy #625

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from

Conversation

Prajwal17Tunerlabs
Copy link
Collaborator

No description provided.

@priyanka-TL priyanka-TL changed the base branch from master to develop February 22, 2024 04:29
@@ -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 : '',
Copy link
Contributor

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',
Copy link
Contributor

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

Comment on lines +57 to +60
external_mentee_visibility: {
type: DataTypes.STRING,
defaultValue: 'CURRENT',
},
Copy link
Contributor

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

Comment on lines +57 to +60
external_mentee_visibility: {
type: DataTypes.STRING,
defaultValue: 'CURRENT',
},
Copy link
Contributor

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.",
Copy link
Contributor

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

try {
let organization_ids = []

const attributes =
filter_type.toLowerCase() == common.MENTEE_ROLE
Copy link
Collaborator

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 =
Copy link
Collaborator

@priyanka-TL priyanka-TL Mar 11, 2024

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
Copy link
Collaborator

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) {
Copy link
Collaborator

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')`
Copy link
Collaborator

@priyanka-TL priyanka-TL Mar 11, 2024

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})`
Copy link
Collaborator

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,
Copy link
Collaborator

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants