Skip to content

Conversation

@skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Jul 30, 2025

Summary

image

The same behaviour can be seen for password or date enforce

  1. Enable Always ask for a password or Set default expiration date for shares via link or mail
  2. Then enable password or date ENFORCE
  3. Disable the initial Always ask for a password or Set default expiration date for shares via link or mail checkbox

The ENFORCE setting is still set to true in the DB. Despite the parent checkbox being disabled
That means we need to check for both checkboxes to really ensure the date or password is enforced

Screenshot bug

image

Checklist

@skjnldsv skjnldsv added this to the Nextcloud 32 milestone Jul 30, 2025
@skjnldsv skjnldsv self-assigned this Jul 30, 2025
@skjnldsv skjnldsv requested a review from a team as a code owner July 30, 2025 12:58
@skjnldsv skjnldsv added the bug label Jul 30, 2025
@skjnldsv skjnldsv requested review from susnux and removed request for a team July 30, 2025 12:58
@skjnldsv skjnldsv added the 3. to review Waiting for reviews label Jul 30, 2025
@skjnldsv skjnldsv requested review from nfebe and szaimen July 30, 2025 12:58
@github-project-automation github-project-automation bot moved this to 🏗️ In progress in 📁 Files team Jul 30, 2025
@skjnldsv

This comment was marked as resolved.

@skjnldsv
Copy link
Member Author

skjnldsv commented Jul 30, 2025

/backport 627f8ca to stable31

@skjnldsv
Copy link
Member Author

skjnldsv commented Jul 30, 2025

/backport 627f8ca to stable30

@skjnldsv skjnldsv requested a review from nilsding July 30, 2025 13:00
@nextcloud-command nextcloud-command requested a review from a team as a code owner July 30, 2025 13:10
@skjnldsv skjnldsv enabled auto-merge July 30, 2025 15:26
@szaimen szaimen removed their request for review July 31, 2025 10:53
@skjnldsv

This comment was marked as resolved.

@nextcloud-command nextcloud-command force-pushed the fix/file-request-enforced branch from 74b4467 to 92f666a Compare August 2, 2025 07:46
@skjnldsv

This comment was marked as resolved.

skjnldsv and others added 2 commits August 2, 2025 12:22
…be enforced

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@nextcloud-command nextcloud-command force-pushed the fix/file-request-enforced branch from 92f666a to 7f93711 Compare August 2, 2025 12:24
Copy link
Contributor

@nfebe nfebe left a comment

Choose a reason for hiding this comment

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

The ENFORCE setting is still set to true in the DB. Despite the parent checkbox being disabled
That means we need to check for both checkboxes to really ensure the date or password is enforced

These new checks solve it on the client side but where are the checks to remove the db from the inconsistent state?

You need add a change that unchecks the sub checkbox when the main is unchecked making sure both requests are sent to the db? (This would fix the original but and the existing fix with be a guardrail)

@skjnldsv
Copy link
Member Author

skjnldsv commented Aug 4, 2025

@nfebe no, it's been like that forever.
Please merge this and we can discuss about improving the backend.

@skjnldsv skjnldsv merged commit 662838b into master Aug 4, 2025
192 of 208 checks passed
@skjnldsv skjnldsv deleted the fix/file-request-enforced branch August 4, 2025 17:18
@skjnldsv
Copy link
Member Author

skjnldsv commented Aug 4, 2025

where the checks to remove the db from the inconsistent state?

One could argue you don't remove previously set configs.
We can chat about this code in a followup, but fixing the front is one thing, changing helpers that are used in many places for 10 years is another

$excludedGroups = $this->config->getAppValue('core', 'shareapi_enforce_links_password_excluded_groups', '');
if ($excludedGroups !== '' && $checkGroupMembership) {
$excludedGroups = json_decode($excludedGroups);
$user = $this->userSession->getUser();
if ($user) {
$userGroups = $this->groupManager->getUserGroupIds($user);
if ((bool)array_intersect($excludedGroups, $userGroups)) {
return false;
}
}
}
return $this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes';
}

/**
* Check if a password is required for each public link
*
* @param bool $checkGroupMembership Check group membership exclusion
* @return bool
* @deprecated 32.0.0 use OCP\Share\IManager's shareApiLinkEnforcePassword directly
*/
public static function isPublicLinkPasswordRequired(bool $checkGroupMembership = true) {
/** @var IManager $shareManager */
$shareManager = \OC::$server->get(IManager::class);
return $shareManager->shareApiLinkEnforcePassword($checkGroupMembership);
}

$enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no');
$enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes';

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

Labels

Projects

Status: ☑️ Done

Development

Successfully merging this pull request may close these issues.

4 participants