Skip to content

feat: control team space provisioning via app config - #2743

Merged
lennart441 merged 1 commit into
nextcloud:masterfrom
lennart441:feat/config-team-folder-auto-create
Aug 27, 2026
Merged

feat: control team space provisioning via app config#2743
lennart441 merged 1 commit into
nextcloud:masterfrom
lennart441:feat/config-team-folder-auto-create

Conversation

@lennart441

@lennart441 lennart441 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

feat: kill switch for user team-folder provisioning (app config, no admin UI)

Assisted by: Cursor

Related:

Summary

Kill switch for user team-folder provisioning so admins keep quota control. Teams stay creatable.

When disabled:

  • no auto-create on team creation
  • no Circles UI/API self-upgrade
occ config:app:set circles team_folder_auto_create --value="false" --type=boolean

Default remains on. Not exposed in admin settings. Not group-based team-creation limits (#2698). Not per-team wizard skip (#2744).

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes
    Admin toggle removed; no new UI surfaces
  • Documentation (manuals or wiki) has been updated or is not required
    Documented in PR description (occ config:app:set)
  • Backports requested where applicable (ex: critical bugfixes)
    no
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component)
  • Milestone added for target branch/version (ex: 32.x for stable32)

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lennart441
lennart441 force-pushed the feat/config-team-folder-auto-create branch 2 times, most recently from af1f1eb to d31ced6 Compare August 11, 2026 14:57
@lennart441
lennart441 force-pushed the feat/config-team-folder-auto-create branch from d31ced6 to adf249b Compare August 18, 2026 14:37
@lennart441
lennart441 marked this pull request as ready for review August 18, 2026 20:44
@github-project-automation github-project-automation Bot moved this to Backlog in 👥 Teams Aug 19, 2026
@alimmroth alimmroth moved this from Backlog to In review in 👥 Teams Aug 19, 2026
Comment thread lib/Service/TeamFolderPolicy.php Outdated
* Defaults to true when unset. OCC upgrade commands bypass this gate.
*/
public function isTeamFolderProvisioningEnabled(): bool {
$value = $this->config->getSystemValue(self::SYSTEM_TEAM_FOLDER_AUTO_CREATE, null);

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.

Can't this be an app config instead?

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.

I would try to avoid 'poluting' the system config for such specific configs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It can be app config technically, but we put it in config.php on purpose.

This PR follows the direction from @jospoortvliet on #2698: keep the strong default (teams + team spaces), and if a restriction is needed, only allow it in config.php so it is not the first thing admins reach for in the UI (and so we do not treat Nextcloud Teams like a feature to turn off). #2698 had this as an admin/app setting; we closed that PR in favor of this one for that reason.

App config would still be changeable via occ config:app:set and is easy to surface again in admin settings later. System config keeps this as an explicit ops-level opt-out, which matches that discussion.

Happy to revisit if you still prefer app config with the UI kept out.

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.

Yes, let's keep it in the app config :)

@artonge artonge 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.

This is still a system config and not an app config

Comment thread lib/Service/TeamFolderPolicy.php Outdated
Comment on lines +50 to +51
public function isTeamFolderProvisioningEnabled(): bool {
$value = $this->config->getSystemValue(self::SYSTEM_TEAM_FOLDER_AUTO_CREATE, null);

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.

To make sure that it is not miss-used.

Suggested change
public function isTeamFolderProvisioningEnabled(): bool {
$value = $this->config->getSystemValue(self::SYSTEM_TEAM_FOLDER_AUTO_CREATE, null);
public function isTeamFolderAutoProvisioningEnabled(): bool {
$value = $this->config->getSystemValue(self::SYSTEM_TEAM_FOLDER_AUTO_CREATE, null);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed the name is easy to misread, but …AutoProvisioning… would be the wrong contract.

This flag is meant to stop user provisioning (create + UI/API self-upgrade), not only auto-create, so quota stays under admin control. OCC is not gated.

Happy to rename to something like isUserTeamFolderProvisioningEnabled instead.

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.

If this is not about auto-provisioning, let's rename the name of the config

Comment thread lib/Controller/TeamFolderController.php
/**
* Admin escape hatch to provision team spaces for existing teams.
*
* This bypasses the config.php gate (`circles.team_folder_auto_create`) that

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.

This is not a bypass if the config is only about blocking auto-provisioning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair on the wording. OCC is the admin path and must keep working when user provisioning is off. I will drop “bypass” in comments/docs and say: user paths honour the flag, OCC does not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

see above - do what is quickest.

@lennart441

Copy link
Copy Markdown
Contributor Author

This PR is the original plan after #2698 / Jos: teams stay creatable, but user team-folder provisioning can be switched off so quota stays under admin control (OCC still works).

That is not really #2744 (optional skip per team in the wizard). Happy to open a dedicated issue and retarget if that helps.

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@jospoortvliet

Copy link
Copy Markdown
Member

This PR is the original plan after #2698 / Jos: teams stay creatable, but user team-folder provisioning can be switched off so quota stays under admin control (OCC still works).

That is not really #2744 (optional skip per team in the wizard). Happy to open a dedicated issue and retarget if that helps.

yeah, two different things. just discussed - so this doesn't have to be in config.php, just not visible in the admin UI - if it can be switched via the command line (occ or editing a config file), it's fine. So to be configured with something like occ app:config:system:set app_id --value "new_value".

But we agreed it is not a big deal either way, so @lennart441 do what is quickest for you:

  • merge this as it is (so other PR's can continue and build on it) and do a separate PR to move this config to the app config
  • change the PR to move this (back?) to app config and then merge.

So whatever works ;-)

@lennart441 lennart441 changed the title feat: control team space auto-create via config.php feat: control team space provisioning via app config Aug 26, 2026
@lennart441

Copy link
Copy Markdown
Contributor Author

Moved the flag from system/config.php to app config as discussed (@artonge / @jospoortvliet):

occ config:app:set circles team_folder_auto_create --value="false" --type=boolean

Still not in admin UI. User paths (auto-create + UI/API upgrade) honour it; occ circles:team-folder:upgrade does not.

@lennart441
lennart441 force-pushed the feat/config-team-folder-auto-create branch from 87522db to 45dd509 Compare August 26, 2026 10:02
@lennart441
lennart441 enabled auto-merge August 26, 2026 10:21
@lennart441

Copy link
Copy Markdown
Contributor Author

/backport to stable35

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.

I don't think we need that command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify: do you mean only circles:team-folder:upgrade, or the whole PR (app-config kill switch for user provisioning)?

If it’s only the OCC command, I can drop it and keep the app-config flag. Note that with the flag off there would then be no admin path to provision spaces unless we leave UI/API upgrade open.

If you mean the whole approach isn’t needed anymore, I’ll close the PR — happy to confirm before I do that. (Context: this would be the second PR on this topic after #2698 that we implemented based on earlier feedback and then walked back.)

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.

I only mean the command.

I don't see use cases to allow bypassing the app-config flag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@artonge done

@lennart441

Copy link
Copy Markdown
Contributor Author

Dropped circles:team-folder:upgrade as requested — no bypass of the app-config flag.

@artonge
artonge disabled auto-merge August 26, 2026 15:14

@artonge artonge 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.

Good besides nitpick.

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.

Probably not needed anymore.

@lennart441
lennart441 enabled auto-merge August 26, 2026 15:28
@lennart441
lennart441 disabled auto-merge August 26, 2026 15:28
@lennart441
lennart441 enabled auto-merge August 26, 2026 15:34
@artonge

artonge commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

And please cleanup your git history

@lennart441

Copy link
Copy Markdown
Contributor Author

And please cleanup your git history

Squashed to a single commit on current master

Keep the flag off the admin UI; set it with occ config:app:set.
When disabled, auto-create and Circles UI/API upgrade are blocked.

Signed-off-by: Lennart Joswig <mail@ljoswig.de>
Co-authored-by: Cursor <cursoragent@cursor.com>
@lennart441
lennart441 force-pushed the feat/config-team-folder-auto-create branch from 4110db4 to 00a5cd1 Compare August 27, 2026 09:43

import 'cropperjs/dist/cropper.css'

const teamFolderProvisioningEnabled = Boolean(loadState('circles', 'teamFolderProvisioningEnabled', true))

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.

Not needed too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the extra look.

The initial state / canCreateTeamFolder check is intentional, not leftover from the OCC command.

The goal is that admins can keep quota fully under their control. If team_folder_auto_create is off, users should not be able to consume team-space quota — whether the folder is created with the team or attached afterwards via the UI. Those two paths are the same from a quota perspective.

So we hide the upgrade action in the UI (and the API already returns 403) when the flag is off. Auto-create-only would still let someone create a team first and add the space later.

At least, that was my intention.

@lennart441
lennart441 merged commit d924d8d into nextcloud:master Aug 27, 2026
44 of 45 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in 👥 Teams Aug 27, 2026
@lennart441
lennart441 deleted the feat/config-team-folder-auto-create branch August 28, 2026 11:38
@artonge

artonge commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

/backport to stable35

@backportbot

backportbot Bot commented Sep 2, 2026

Copy link
Copy Markdown

The backport to stable35 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable35
git pull origin stable35

# Create the new backport branch
git checkout -b backport/2743/stable35

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 00a5cd1a

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/2743/stable35

Error: Failed to check for changes with origin/stable35: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants