Skip to content

Commit

Permalink
Comments addressed
Browse files Browse the repository at this point in the history
Comments of the PR wso2#384
  • Loading branch information
Achintha Isuru committed Jun 9, 2023
1 parent 732b9bc commit 83fabfe
Show file tree
Hide file tree
Showing 38 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import getStartedWelcomeImage from
import styles from "../../../../../styles/Settings.module.css";

export default function GetStartedText() {

return (
<div className={ styles.getStartedSectionComponentGetStartedTextDiv }>
<Panel bordered className={ styles.getStartedSectionComponentGetStartedTextPanel }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default function IdpSectionComponent(props: IdpSectionComponentProps) {
};

const onIdpCreated = (response: IdentityProvider): void => {

if (response) {
successTypeDialog(toaster, "Success", "Identity Provider is created successfully");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default function ButtonGroupIdentityProviderDetails(props : ButtonGroupId
}, [ idpDetails, applicationDetail ]);

const onIdpDelete = (response: boolean): void => {

if (response) {
successTypeDialog(toaster, "Success", "Identity provider is deleted successfully");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function ApplicationListAvailable(props: ApplicationListAvailableProps) {
*
* @param prop - application
*
* @returns The component to show the applicaiton name and the description
* @returns The component to show the applicaiton name and the description.
*/
function ApplicationListItem(props: ApplicationListItemProps) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export default function IdpCreate(prop: IdpCreateProps) {
onCancel={ onCancel } />);

case ENTERPRISE_ID:

return (<ExternalIdentityProvider
session={ session }
template={ template }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export default function AddUserComponent(props: AddUserComponentProps) {
}

function EmailInvitePanel() {

return (
<Panel bordered>
<Stack spacing={ 30 }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import { Session } from "next-auth";
* @returns header object that can used for IS API calls
*/
export function requestOptions(session: Session): RequestInit {

return apiRequestOptions(session, getHostedUrl());
}

export function requestOptionsWithBody(session: Session, method: RequestMethod, body: BodyInit): RequestInit {

return apiRequestOptionsWithBody(session, method, body, getHostedUrl());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function getImageForTheIdentityProvider(templateId: string): string {
* @returns callBackUrl of the idp.
*/
export function getCallbackUrl(orgId: string): string {

return `${getOrgUrl(orgId)}/commonauth`;
}

Expand Down Expand Up @@ -86,7 +87,6 @@ export function setIdpTemplate(model: IdentityProviderTemplateModel, templateId:
model.federatedAuthenticators.authenticators[0].isEnabled = true;

return model;

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function controllerDecodeGetApplication(session: Session, id: strin
await commonControllerDecode(() => controllerCallGetApplication(session, id), null) as Application | null);

return res;

}

export default controllerDecodeGetApplication;
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export async function controllerDecodeListAllApplications(session: Session): Pro
ApplicationList | null);

return res;

}

export default controllerDecodeListAllApplications;
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function controllerDecodeListCurrentApplication(session: Session):
ApplicationList | null);

return res;

}

export default controllerDecodeListCurrentApplication;
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function addRemoveAuthSequence(template: Application, idpTempleteId: string, idp
authenticationSequenceModel.steps.forEach((step: AuthenticationSequenceStep) => {
step.options = step.options.filter((option: AuthenticationSequenceStepOption) => {
if (option.idp === idpName) {

return false;
} else if (option.authenticator === "BasicAuthenticator") {
basicCheck = true;
Expand Down Expand Up @@ -156,6 +157,7 @@ export async function controllerDecodePatchApplicationAuthSteps(
() => controllerCallPatchApplicationAuthSteps(session, applicationId, authenticationSequenceModel), null);

if (res) {

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ function getOrgId(token: JWT): string {

if (token.user) {
if (token.user.user_organization) {

return token.user.user_organization;
} else if (config.CommonConfig.ApplicationConfig.SampleOrganization[0]) {

return config.CommonConfig.ApplicationConfig.SampleOrganization[0].id;
} else {

return token.user.org_id;
}
} else {

return config.CommonConfig.ApplicationConfig.SampleOrganization[0].id;
}

Expand All @@ -61,7 +65,6 @@ export async function controllerDecodeSwitchOrg(token: JWT): Promise<OrgSession
(await commonControllerDecode(() => controllerCallSwitchOrg(subOrgId, accessToken), null) as OrgSession | null);

return res;

}

export default controllerDecodeSwitchOrg;
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export async function controllerDecodeCreateIdentityProvider(session: Session, t
null) as IdentityProvider | null);

return res;

}

export default controllerDecodeCreateIdentityProvider;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export async function controllerDecodeDeleteIdentityProvider(session: Session, i
}

return res;

}

export default controllerDecodeDeleteIdentityProvider;
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export async function controllerDecodeGetDetailedIdentityProvider(session: Sessi
null) as IdentityProvider | null);

return res;

}

export default controllerDecodeGetDetailedIdentityProvider;
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export async function controllerDecodeGetFederatedAuthenticators(session: Sessio
null) as IdentityProviderFederatedAuthenticator | null);

return res;

}

export default controllerDecodeGetFederatedAuthenticators;
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export async function controllerDecodeUpdateFederatedAuthenticators(
null) as IdentityProviderFederatedAuthenticator | null);

return res;

}

export default controllerDecodeUpdateFederatedAuthenticators;
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function getUsersList(users: string[]): RoleUsers[] {
}

function getRoleBody(displayName: string, permissions: string[], users: string[]): Role {

return {
"displayName": displayName,
"groups": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ import { Session } from "next-auth";
import { controllerDecodePatchRole } from "../controllerPatchRole/controllerDecodePatchRole";

function getRolesThatNeedToAddUser(initRoleList: string[], roleList: string[]): string[] {

return roleList.filter(roleUri => !initRoleList.includes(roleUri));
}

function getRolesThatNeedToRemoveUser(initRoleList: string[], roleList: string[]): string[] {

return initRoleList.filter(roleUri => !roleList.includes(roleUri));
}

Expand Down Expand Up @@ -74,6 +76,7 @@ export async function controllerDecodeEditRolesToAddOrRemoveUser(
session: Session, userId: string, initRoleList: string[], roleList: string[]): Promise<boolean> {

try {

return getRoleDetailsForAdd(session, userId, initRoleList, roleList)
.then(
(res: boolean) => {
Expand All @@ -90,7 +93,6 @@ export async function controllerDecodeEditRolesToAddOrRemoveUser(

return false;
}

}

export default controllerDecodeEditRolesToAddOrRemoveUser;
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export async function controllerDecodeGetRole(session: Session, roleUri: string)
const res = (await commonControllerDecode(() => controllerCallGetRole(session, roleUri), null) as Role | null);

return res;

}

export default controllerDecodeGetRole;
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export async function controllerDecodeListAllRoles(session: Session): Promise<Ro
}

return res;

}

export default controllerDecodeListAllRoles;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Session } from "next-auth";
import { controllerCallPatchRole } from "./controllerCallPatchRole";

function getAddReplaceBody(patchMethod: PatchMethod, path: string, value: string[] | string): PatchBody {

return {
"operations": [
{
Expand All @@ -36,6 +37,7 @@ function getAddReplaceBody(patchMethod: PatchMethod, path: string, value: string
}

function getRemoveBody(patchMethod: PatchMethod, path: string, value: string[] | string): PatchBody {

return {
"operations": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export async function controllerDecodeUserRole(session: Session, id: string): Pr
const res = (await commonControllerDecode(() => controllerCallUserRole(session, id), null) as Role[] | null);

return res;

}

export default controllerDecodeUserRole;
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ export async function controllerCallAddUser(session: Session, user: SendUser): P
const data = (await commonControllerCall("/api/settings/user/addUser", session, user) as User | null);

return data;

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export async function controllerDecodeAddUser(
await commonControllerDecode(() => controllerCallAddUser(session, addUserEncode), false) as User | boolean);

return res;

}

export default { InviteConst, controllerDecodeAddUser };
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export async function controllerDecodeEditUser(
await commonControllerDecode(() => controllerCallEditUser(session, id, editUserEncode), false) as User | null);

return usersData;

}

export default controllerDecodeEditUser;
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export async function controllerDecodeViewUsers(session: Session): Promise<Inter
}

return usersData;

}

export default controllerDecodeViewUsers;
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import { Session } from "next-auth";
* @returns header object that can used for IS API calls.
*/
export function requestOptions(session: Session): RequestInit {

return apiRequestOptions(session, getHostedUrl());
}

export function requestOptionsWithBody(session: Session, method: string, body: BodyInit): RequestInit {

return apiRequestOptionsWithBody(session, method, body, getHostedUrl());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ export async function controllerCallMe(session: Session): Promise<InternalUser |
const data = ( await commonControllerCall("/api/dashboard/me", session) as InternalUser | null);

return data;

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export async function controllerDecodeMe(session: Session) : Promise<InternalUse
}

return null;

}

export default controllerDecodeMe;
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function getOrgId(token: JWT): string {

return config.CommonConfig.ApplicationConfig.SampleOrganization[0].id;
}

}

/**
Expand All @@ -57,7 +56,6 @@ export async function controllerDecodeSwitchOrg(token: JWT): Promise<OrgSession
await commonControllerDecode(() => controllerCallSwitchOrg(subOrgId, accessToken), null) as OrgSession | null);

return res;

}

export default controllerDecodeSwitchOrg;
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ export function setEmail(email: string) {
*/
export function setUsername(userName: string) {
if (config.BusinessAppConfig.ManagementAPIConfig.UserStore.trim()===""){

return userName;
} else {

return `${config.BusinessAppConfig.ManagementAPIConfig.UserStore}/${userName}`;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from "react";
import styles from "./footerComponent.module.css";

export function FooterComponent() {

return (
<footer className={ styles["footer"] }>
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import { SideNavItem, SideNavList } from "@b2bsample/shared/data-access/data-access-common-models-util";
import { getIconFromString, hideBasedOnScopes } from "@b2bsample/shared/util/util-front-end-util";
import { Button, FlexboxGrid, Nav, Sidenav, Stack, Tag } from "rsuite";
import { Button, Nav, Sidenav, Stack, Tag } from "rsuite";
import "rsuite/dist/rsuite.min.css";
import styles from "./sidenavComponent.module.css";
import { SidenavComponentProps } from "../../models/sidenavComponent/sidenavComponent";
Expand All @@ -44,6 +44,7 @@ export function SidenavComponent(prop: SidenavComponentProps) {
sideNavConfigList.items.map((item: SideNavItem) => {

if (item.items) {

return (
<Nav.Menu
eventKey={ item.eventKey }
Expand All @@ -61,7 +62,8 @@ export function SidenavComponent(prop: SidenavComponentProps) {
onSelect={ (eventKey) =>
activeKeySideNavSelect(eventKey) }
style={ item.hideBasedOnScope
? hideBasedOnScopes(scope, item.type, item.items, item.scopes)
? hideBasedOnScopes(
scope, item.type, item.items, item.scopes)
: {} }>
<Stack spacing={ 10 }>
{ item.title }
Expand All @@ -75,6 +77,7 @@ export function SidenavComponent(prop: SidenavComponentProps) {
</Nav.Menu>
);
} else {

return (
<Nav.Item
key={ item.eventKey }
Expand Down
Loading

0 comments on commit 83fabfe

Please sign in to comment.