Skip to content

Conversation

@vg006
Copy link

@vg006 vg006 commented Dec 31, 2025

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Issue being fixed

Fixes #22688

Summary

This PR fixes the improper bindings of the attribute disabled in the project-policy-config.component.html component file.

Overview of changes made

  • project-policy-config.component.html

    Fixed all the improper bindings of the attribute disabled in the component, as described in the issue.

     <input 
    -   disabled="!allowUpdateProxyCacheConfiguration"
    +   [disabled]="!allowUpdateProxyCacheConfiguration"
      ...
     />
  • project-policy-config.component.ts

    Added logic to change the property allowUpdateProxyCacheConfiguration based on the permissions, since the variable is initialized with a default value false (ref) in the file and the variable is neither used nor mutated.

     private getPermission(): void {
        this.userPermission
            .getPermission(
                this.projectId,
                USERSTATICPERMISSION.CONFIGURATION.KEY,
                USERSTATICPERMISSION.CONFIGURATION.VALUE.UPDATE
            )
            .subscribe(permissins => {
                this.hasChangeConfigRole = permissins as boolean;
    +           this.allowUpdateProxyCacheConfiguration =
    +             this.hasChangeConfigRole && !this.isProxyCacheProject;
            });
    }

Result:

image

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. release-note/update, release-note/enhancement
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@vg006 vg006 requested a review from a team as a code owner December 31, 2025 05:24
@vg006
Copy link
Author

vg006 commented Dec 31, 2025

To the maintainers @bupd @Vad1mo @chlins @MinerYang,

This will enable only the System Admin to configure Proxy Cache settings, not even Project Admin can configure it.
Should it be configured in such way or need any change in access model?

@bupd
Copy link
Contributor

bupd commented Dec 31, 2025

@vg006 Project admins should be able to configure proxy cache.

@vg006 vg006 force-pushed the fix/ui branch 2 times, most recently from 325ca7c to 83c5d93 Compare December 31, 2025 17:21
@vg006
Copy link
Author

vg006 commented Jan 1, 2026

Initially the component is configured only to be accessed by the System Admin. But as per your suggestion, I made this change in the component which allows the Project Admin in addition, to access the proxy configuration.

- *ngIf="isSystemAdmin"
+ *ngIf="hasChangeConfigRole"

@bupd Can you review the changes[1][2] once and ensure whether it satisfies the requirements?

@vg006
Copy link
Author

vg006 commented Jan 8, 2026

@bupd
This branch is rebased on top of upstream's main branch and is now ready for merge.

Copy link
Contributor

@bupd bupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vg006 Thanks for your contribution,

you cannot update a proxy cache to normal and vice versa so the checkbox should always be in disabled state.

type="checkbox"
clrCheckbox
disabled="!allowUpdateProxyCacheConfiguration"
[disabled]="!allowUpdateProxyCacheConfiguration"
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 always be disabled, since backend does not allow converting a normal project into proxy cache and vice versa. this should be set to disabled=true indefinitely.

</clr-control-helper>
</clr-checkbox-container>
<clr-checkbox-container *ngIf="isSystemAdmin" clrInline>
<clr-checkbox-container *ngIf="hasChangeConfigRole" clrInline>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to go.

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.

Fix disabled attribute binding in project-policy-config max_upstream_conn input

5 participants