-
Notifications
You must be signed in to change notification settings - Fork 28
[ENG-10712] Merge latest develop into feature branch
#948
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
Merged
cslzchen
merged 5 commits into
CenterForOpenScience:feature/osf4i-in-progress-sso
from
Ostap-Zherebetskyi:osf4i-in-progress-sso/merge_develop
Apr 16, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f9da526
[ENG-10063] orcid integration (#939)
futa-ikeda e3933bd
Update chagne log and bump version
cslzchen 92af918
Merge branch 'release/26.7.0'
cslzchen ee958a1
Merge tag '26.7.0' into develop
cslzchen 6de5450
Merge remote-tracking branch 'upstream/develop' into osf4i-in-progres…
Ostap-Zherebetskyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../profile-settings/components/authenticated-identity/authenticated-identity.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <div class="flex flex-column row-gap-4 border-1 border-round-lg grey-border-color p-3 md:p-4 xl:p-5"> | ||
| <div class="flex flex-row justify-content-between"> | ||
| <h2> | ||
| {{ 'settings.profileSettings.social.labels.authenticatedIdentity' | translate }} | ||
| </h2> | ||
| </div> | ||
| <div class="flex flex-column row-gap-4 w-full md:flex-row md:align-items-end md:column-gap-3"> | ||
| <div class="w-full md:w-12"> | ||
| @if (existingOrcid()) { | ||
| <div class="flex flex-row align-items-center gap-2"> | ||
| <img ngSrc="assets/icons/colored/orcid.svg" width="16" height="16" alt="orcid" /> | ||
| <a class="font-bold" [href]="orcidUrl()"> {{ orcidUrl() }} </a> | ||
| <p-button | ||
| icon="fas fa-times" | ||
| class="w-6 md:w-auto" | ||
| severity="danger" | ||
| variant="text" | ||
| [pTooltip]="'settings.profileSettings.social.disconnectOrcid' | translate" | ||
| [ariaLabel]="'settings.profileSettings.social.disconnectOrcid' | translate" | ||
| (onClick)="disconnectOrcid()" | ||
| > | ||
| </p-button> | ||
| </div> | ||
| } @else { | ||
| <img ngSrc="assets/images/integrations/orcid-logotype.png" width="130" height="40" alt="orcid" /> | ||
| <p class="mt-2" [innerHTML]="'settings.profileSettings.social.orcidDescription' | translate"></p> | ||
| <p class="mt-2 font-bold">{{ 'settings.profileSettings.social.orcidWarning' | translate }}</p> | ||
| <div class="mt-2"> | ||
| <p-button | ||
| class="w-6 md:w-auto" | ||
| [label]="'settings.profileSettings.social.connectOrcid' | translate" | ||
| severity="secondary" | ||
| (onClick)="connectOrcid()" | ||
| > | ||
| </p-button> | ||
| </div> | ||
| } | ||
| </div> | ||
| </div> | ||
| </div> |
Empty file.
71 changes: 71 additions & 0 deletions
71
...ofile-settings/components/authenticated-identity/authenticated-identity.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { MockProvider } from 'ng-mocks'; | ||
|
|
||
| import { signal } from '@angular/core'; | ||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { AccountSettingsSelectors } from '@osf/features/settings/account-settings/store/account-settings.selectors'; | ||
| import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; | ||
|
|
||
| import { AuthenticatedIdentityComponent } from './authenticated-identity.component'; | ||
|
|
||
| import { OSFTestingModule } from '@testing/osf.testing.module'; | ||
| import { | ||
| CustomConfirmationServiceMock, | ||
| CustomConfirmationServiceMockType, | ||
| } from '@testing/providers/custom-confirmation-provider.mock'; | ||
| import { provideMockStore } from '@testing/providers/store-provider.mock'; | ||
|
|
||
| describe('AuthenticatedIdentityComponent', () => { | ||
| let component: AuthenticatedIdentityComponent; | ||
| let fixture: ComponentFixture<AuthenticatedIdentityComponent>; | ||
| let customConfirmationServiceMock: CustomConfirmationServiceMockType; | ||
|
|
||
| const mockExternalIdentities = signal([ | ||
| { | ||
| id: 'ORCID', | ||
| externalId: '0001-0002-0003-0004', | ||
| status: 'VERIFIED', | ||
| }, | ||
| ]); | ||
|
|
||
| beforeEach(async () => { | ||
| customConfirmationServiceMock = CustomConfirmationServiceMock.simple(); | ||
| await TestBed.configureTestingModule({ | ||
| imports: [AuthenticatedIdentityComponent, OSFTestingModule], | ||
| providers: [ | ||
| MockProvider(CustomConfirmationService, customConfirmationServiceMock), | ||
| provideMockStore({ | ||
| signals: [ | ||
| { | ||
| selector: AccountSettingsSelectors.getExternalIdentities, | ||
| value: mockExternalIdentities, | ||
| }, | ||
| ], | ||
| }), | ||
| ], | ||
| }).compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(AuthenticatedIdentityComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('should show existing user ORCID when present in external identities', () => { | ||
| expect(component.existingOrcid()).toEqual('0001-0002-0003-0004'); | ||
| expect(component.orcidUrl()).toEqual('https://orcid.org/0001-0002-0003-0004'); | ||
| component.disconnectOrcid(); | ||
| expect(customConfirmationServiceMock.confirmDelete).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it('should show connect button when no existing ORCID is present in external identities', () => { | ||
| mockExternalIdentities.set([]); | ||
| fixture.detectChanges(); | ||
|
|
||
| expect(component.existingOrcid()).toBeUndefined(); | ||
| expect(component.orcidUrl()).toBeNull(); | ||
| }); | ||
| }); |
92 changes: 92 additions & 0 deletions
92
...gs/profile-settings/components/authenticated-identity/authenticated-identity.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| import { createDispatchMap, select } from '@ngxs/store'; | ||
|
|
||
| import { TranslatePipe } from '@ngx-translate/core'; | ||
|
|
||
| import { Button } from 'primeng/button'; | ||
| import { Tooltip } from 'primeng/tooltip'; | ||
|
|
||
| import { finalize } from 'rxjs'; | ||
|
|
||
| import { NgOptimizedImage } from '@angular/common'; | ||
| import { ChangeDetectionStrategy, Component, computed, inject, OnInit } from '@angular/core'; | ||
|
|
||
| import { ENVIRONMENT } from '@core/provider/environment.provider'; | ||
| import { AuthService } from '@core/services/auth.service'; | ||
| import { ExternalIdentityStatus } from '@osf/shared/enums/external-identity-status.enum'; | ||
| import { CustomConfirmationService } from '@osf/shared/services/custom-confirmation.service'; | ||
| import { LoaderService } from '@osf/shared/services/loader.service'; | ||
| import { ToastService } from '@osf/shared/services/toast.service'; | ||
|
|
||
| import { | ||
| AccountSettingsSelectors, | ||
| DeleteExternalIdentity, | ||
| GetExternalIdentities, | ||
| } from '../../../account-settings/store'; | ||
| import { ProfileSettingsTabOption } from '../../enums'; | ||
|
|
||
| @Component({ | ||
| selector: 'osf-authenticated-identity', | ||
| imports: [NgOptimizedImage, Button, Tooltip, TranslatePipe], | ||
| templateUrl: './authenticated-identity.component.html', | ||
| styleUrl: './authenticated-identity.component.scss', | ||
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| }) | ||
| export class AuthenticatedIdentityComponent implements OnInit { | ||
| private readonly authService = inject(AuthService); | ||
| private readonly environment = inject(ENVIRONMENT); | ||
| private readonly customConfirmationService = inject(CustomConfirmationService); | ||
| private readonly toastService = inject(ToastService); | ||
| private readonly loaderService = inject(LoaderService); | ||
|
|
||
| private readonly ORCID_PROVIDER = 'ORCID'; | ||
|
|
||
| ngOnInit() { | ||
| this.actions.getExternalIdentities(); | ||
| } | ||
|
|
||
| readonly actions = createDispatchMap({ | ||
| deleteExternalIdentity: DeleteExternalIdentity, | ||
| getExternalIdentities: GetExternalIdentities, | ||
| }); | ||
|
|
||
| readonly externalIdentities = select(AccountSettingsSelectors.getExternalIdentities); | ||
|
|
||
| readonly orcidUrl = computed(() => { | ||
| return this.existingOrcid() ? `https://orcid.org/${this.existingOrcid()}` : null; | ||
| }); | ||
|
|
||
| readonly existingOrcid = computed( | ||
| (): string | undefined => | ||
| this.externalIdentities()?.find((i) => i.id === 'ORCID' && i.status === ExternalIdentityStatus.VERIFIED) | ||
| ?.externalId | ||
| ); | ||
|
|
||
| disconnectOrcid(): void { | ||
| this.customConfirmationService.confirmDelete({ | ||
| headerKey: 'settings.accountSettings.connectedIdentities.deleteDialog.header', | ||
| messageParams: { name: this.ORCID_PROVIDER }, | ||
| messageKey: 'settings.accountSettings.connectedIdentities.deleteDialog.message', | ||
| onConfirm: () => { | ||
| this.loaderService.show(); | ||
| this.actions | ||
| .deleteExternalIdentity(this.ORCID_PROVIDER) | ||
| .pipe(finalize(() => this.loaderService.hide())) | ||
| .subscribe(() => this.toastService.showSuccess('settings.accountSettings.connectedIdentities.successDelete')); | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| connectOrcid(): void { | ||
| const webUrl = this.environment.webUrl; | ||
| const casUrl = this.environment.casUrl; | ||
| const finalDestination = new URL(`${webUrl}/settings/profile`); | ||
| finalDestination.searchParams.set('tab', ProfileSettingsTabOption.Social.toString()); | ||
| const casLoginUrl = new URL(`${casUrl}/login`); | ||
| casLoginUrl.search = new URLSearchParams({ | ||
| redirectOrcid: 'true', | ||
| service: `${webUrl}/login`, | ||
| next: encodeURIComponent(finalDestination.toString()), | ||
| }).toString(); | ||
| this.authService.logout(casLoginUrl.toString()); | ||
| } | ||
| } |
2 changes: 2 additions & 0 deletions
2
src/app/features/settings/profile-settings/components/social/social.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export enum ExternalIdentityStatus { | ||
| VERIFIED = 'VERIFIED', | ||
| LINK = 'LINK', | ||
| CREATE = 'CREATE', | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Note for the record: ran into merge conflicts here and fixed