Skip to content

feat(admin): add admin settings for file sharing options#136

Open
Thomas-git wants to merge 1 commit into
nextcloud:mainfrom
Thomas-git:feature/admin-file-sharing-options
Open

feat(admin): add admin settings for file sharing options#136
Thomas-git wants to merge 1 commit into
nextcloud:mainfrom
Thomas-git:feature/admin-file-sharing-options

Conversation

@Thomas-git

Copy link
Copy Markdown

This is my answer to #128

Admins can now configure which sharing options (upload, public link, internal link) are available to users, and which one is pre-selected by default in the send files dialog.

If nothing is configured, behavior is unchanged: all three options are available and the upload option is pre-selected.

Assisted-by: Claude Sonnet 4.6 noreply@anthropic.com

🤖 AI (if applicable)

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

Admins can now configure which sharing options (upload, public link,
internal link) are available to users, and which one is pre-selected
by default in the send files dialog.

If nothing is configured, behavior is unchanged: all three options are
available and the upload option is pre-selected.

Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Thomas Ritou <thomas@ritou.me>
@Thomas-git
Thomas-git force-pushed the feature/admin-file-sharing-options branch from 9ddc97f to d465960 Compare June 22, 2026 15:25

@kyteinsky kyteinsky left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thanks for the PR, it works beautifully!

one thing to note is that the restriction is made only in the frontend. The php backend still allows the requests to pass without checking the admin config.
The config values should be fetched and checks should be performed in

public function sendMessage(string $messageType, string $message, int $channelId,

public function sendFile(int $fileId, string $messageType, int $channelId,

public function sendPublicLinks(array $fileIds, string $messageType, int $channelId,

Comment on lines +31 to +37
$adminConfig = [
'send_type_enabled_file' => $this->config->getAppValue(Application::APP_ID, 'send_type_enabled_file', '1') === '1',
'send_type_enabled_public_link' => $this->config->getAppValue(Application::APP_ID, 'send_type_enabled_public_link', '1') === '1',
'send_type_enabled_internal_link' => $this->config->getAppValue(Application::APP_ID, 'send_type_enabled_internal_link', '1') === '1',
'send_type_default' => $this->config->getAppValue(Application::APP_ID, 'send_type_default', ''),
];
$this->initialStateService->provideInitialState('admin-config', $adminConfig);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this would read and inject these values in every page of nextcloud so is a bit wasteful
it would be better to add a #[NoAdminRequired] path in ConfigController.php to read them from the filesplugin.js file

Comment thread src/filesplugin.js
send_type_default: '',
}
try {
adminConfig = loadState('integration_zulip', 'admin-config', adminConfig)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

generateUrl() can be done here and then an axios request to read the admin config values

Comment on lines +32 to +35
<div v-if="enabledSendTypes.length > 1" class="default-type-section">
<h3>{{ t('integration_zulip', 'Default sharing option') }}</h3>
<p class="settings-hint">
{{ t('integration_zulip', 'Select which option is pre-selected when users open the sharing dialog.') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what do you think about having this section still visible when only one send option is available?
it could just show that one option selected to be more explicit but maybe that is already quite evident from the list above?

@Thomas-git Thomas-git Jul 7, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think it's pretty obvious, that's why it's hidden. But maybe a better UI design would be to have this part always visible and to disable unavailable choices?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

yeah that could work too.
but it's just a nitpick, feel free to ignore if the current design feels good to you.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.)

@Thomas-git

Copy link
Copy Markdown
Author

Thank you for your code review. I don't have much time available right now but I will improve my PR with your insights as soon as possible.

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