Skip to content

enh: Unifiy always ask for password and enforce password checkboxes #54245

Description

@nfebe

In sharing settings of the admin section

  • Enable Always ask for a password or Set default expiration date for shares via link or mail
  • Then enable password or date ENFORCE
  • 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

See : #54159

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)

Originally posted by @nfebe in #54159 (review)

Activity

  1. skjnldsv commented on Aug 4, 2025

    @skjnldsv
    Member

    From #54159 (comment)

    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';

  2. nfebe commented on Aug 4, 2025

    @nfebe
    ContributorAuthor

    Simple fix :

    We could fix from the frontend by having a secondary effect on enforce password checkbox, when the state of "always ask for password" changes.

    But ultimately a backend validation is required to never allowed them in a non-compliant state

  3. added theissue type on Aug 4, 2025
  4. moved this from To triage to Triaged in 🧑‍🤝‍🧑 Community triageon Aug 4, 2025
  5. moved this from Triaged to Confirmed in 🧑‍🤝‍🧑 Community triageon Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions