File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -895,8 +895,30 @@ module.exports = class AccountHelper {
895
895
delete user . password
896
896
delete user . otpInfo
897
897
898
+ let defaultOrg = await organizationQueries . findOne (
899
+ { code : process . env . DEFAULT_ORGANISATION_CODE } ,
900
+ { attributes : [ 'id' ] }
901
+ )
902
+ let defaultOrgId = defaultOrg . id
903
+ const modelName = await userQueries . getModelName ( )
904
+
905
+ let validationData = await entityTypeQueries . findUserEntityTypesAndEntities ( {
906
+ status : 'ACTIVE' ,
907
+ organization_id : {
908
+ [ Op . in ] : [ user . organization_id , defaultOrgId ] ,
909
+ } ,
910
+ model_names : { [ Op . contains ] : [ modelName ] } ,
911
+ } )
912
+
913
+ const prunedEntities = removeDefaultOrgEntityTypes ( validationData , user . organization_id )
914
+ user = utils . processDbResponse ( user , prunedEntities )
915
+
898
916
// Check if user and user.image exist, then fetch a downloadable URL for the image
899
- if ( user && user . image ) user . image = await utils . getDownloadableUrl ( user . image )
917
+ if ( user && user . image ) {
918
+ user . image = await utils . getDownloadableUrl ( user . image )
919
+ }
920
+ user . email = plaintextEmailId
921
+
900
922
const result = { access_token : accessToken , refresh_token : refreshToken , user }
901
923
return responses . successResponse ( {
902
924
statusCode : httpStatusCode . ok ,
You can’t perform that action at this time.
0 commit comments