Skip to content

Allow Default View disablement for accounts - #14225

Open
erikbocks wants to merge 1 commit into
apache:mainfrom
scclouds:allow-default-view-disablement
Open

erikbocks wants to merge 1 commit into
apache:mainfrom
scclouds:allow-default-view-disablement

Conversation

@erikbocks

@erikbocks erikbocks commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Description

By default, authenticated users can browse through the interface using either the default view, or the view of a project that they belong to. In some cases, it can be interesting to disable the account view, allowing users to view only the resources of their projects. Thus, this was implemented with the creation of the disable.default.view account configuration.

Name Description Scope Type Default Value
disable.default.view This defines if the account will have access to the Default View, or only to the projects it is associated to. In the GUI, if the account does not have access to any project, the Default View will be rendered. Account Boolean False

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

How Has This Been Tested?

In an environment with two account: admin cloud (the default one) and user, I create a project for user. Then, as the Admin, I enabled the configuration disable.default.view for the user account.

After authenticating as user, I validated that the created project was automatically selected for the view, and the Default View option was not available. I also logged out, and removed the project from the environment. After logging in again, the Default View was available again (because the user is not associated to any project).

I also verified that when an user with disable.default.view enabled has no projects, and he creates a new project, the project menu automatically selects the new project as a view and hides Default View.

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.91%. Comparing base (602d9ec) to head (b58b4d9).

Files with missing lines Patch % Lines
.../cloudstack/api/response/CapabilitiesResponse.java 0.00% 3 Missing ⚠️
...in/java/com/cloud/server/ManagementServerImpl.java 0.00% 2 Missing ⚠️
...k/api/command/user/config/ListCapabilitiesCmd.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14225   +/-   ##
=========================================
  Coverage     19.91%   19.91%           
- Complexity    20200    20203    +3     
=========================================
  Files          6373     6373           
  Lines        577230   577259   +29     
  Branches      70696    70702    +6     
=========================================
+ Hits         114974   114988   +14     
- Misses       449690   449707   +17     
+ Partials      12566    12564    -2     
Flag Coverage Δ
uitests 3.71% <ø> (+<0.01%) ⬆️
unittests 21.19% <14.28%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 4 Medium severity

Open (4)
What changed in this PR

Adds an account-scoped configuration to disable the “Default View” in the UI so users are constrained to project views when they have projects available.

Changes:

  • Introduces an account-level global setting disable.default.view and exposes it via listCapabilities.
  • Updates the Project menu to hide “Default View” when disabled and auto-select a project when available.
  • Enhances InfiniteScrollSelect to react to defaultOption changes and emit update:value.
File Description
ui/​src/​components/​widgets/​InfiniteScrollSelect.vue Reacts to defaultOption changes, tweaks auto-selection, and emits update:value.
ui/​src/​components/​header/​ProjectMenu.vue Hides Default View based on a feature flag + available projects; fetches user projects to decide behavior.
server/​src/​main/​java/​com/​cloud/​user/​AccountManagerImpl.java Registers the new account-scoped config key in the account manager config list.
server/​src/​main/​java/​com/​cloud/​user/​AccountManager.java Defines the new disable.default.view account configuration key.
server/​src/​main/​java/​com/​cloud/​server/​ManagementServerImpl.java Adds disabledefaultview to capabilities output for the caller’s account.
api/​src/​main/​java/​org/​apache/​cloudstack/​api/​response/​CapabilitiesResponse.java Adds the disabledefaultview field to capabilities response.
api/​src/​main/​java/​org/​apache/​cloudstack/​api/​command/​user/​config/​ListCapabilitiesCmd.java Maps the new capability into the response object.
api/​src/​main/​java/​org/​apache/​cloudstack/​api/​ApiConstants.java Introduces DISABLE_DEFAULT_VIEW API constant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server/src/main/java/com/cloud/user/AccountManager.java
created () {
this.selectedProjectId = this.$store.getters?.project?.id || this.defaultOption.id
this.listUserAvailableProjects()
this.selectedProjectId = this.$store.getters?.project?.id || this.defaultOption?.id
Comment on lines +108 to +115
listUserAvailableProjects () {
getAPI('listProjects', { details: 'min', listall: true })
.then((response) => {
this.availableProjects = response.listprojectsresponse?.project || []
if (this.shouldHideDefaultView && !this.$store.getters.project?.id) {
this.selectedProjectId = null
}
})
Comment on lines 350 to 354
if (firstOption) {
const firstValue = firstOption[this.optionValueKey]
this.hasAutoSelectedFirst = true
this.$emit('change-option-value', firstValue)
this.$emit('change-option', firstOption)
this.onChange(firstValue)
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants