Skip to content
Merged
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
10 changes: 5 additions & 5 deletions apps/customer-portal/backend/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ service http:InterceptableService / on new http:Listener(9090) {
# Fetch user information of the logged in user.
#
# + return - User info object or error response
resource function get users/me(http:RequestContext ctx) returns User|http:Forbidden|http:InternalServerError {
resource function get users/me(http:RequestContext ctx) returns User|http:Unauthorized|http:InternalServerError {
authorization:UserInfoPayload|error userInfo = ctx.getWithType(authorization:HEADER_USER_INFO);
if userInfo is error {
return <http:InternalServerError>{
Expand All @@ -91,11 +91,11 @@ service http:InterceptableService / on new http:Listener(9090) {

entity:UserResponse|error userDetails = entity:getUserBasicInfo(userInfo.email, userInfo.idToken);
if userDetails is error {
if getStatusCode(userDetails) == http:STATUS_FORBIDDEN {
log:printWarn(string `User: ${userInfo.userId} does not have access to the customer portal!`);
return <http:Forbidden>{
if getStatusCode(userDetails) == http:STATUS_UNAUTHORIZED {
log:printWarn(string `Access denied for user: ${userInfo.userId} to Customer Portal`);
return <http:Unauthorized>{
body: {
message: "User is not authorized to access the customer portal!"
message: "Unauthorized access to the customer portal."
}
};
Comment thread
Rashmika998 marked this conversation as resolved.
Resolved
}
Comment thread
Rashmika998 marked this conversation as resolved.
Resolved
Expand Down