Merge pull request #4228 from owncloud/enforce_password-block

[Sharing] Do not allow users to uset the password if it is enforced
This commit is contained in:
Klaas Freitag 2015-12-02 10:07:04 +01:00
commit 4a2b5f7cc8
2 changed files with 9 additions and 2 deletions

View file

@ -41,7 +41,8 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
_manager(NULL), _manager(NULL),
_share(NULL), _share(NULL),
_resharingAllowed(resharingAllowed), _resharingAllowed(resharingAllowed),
_autoShare(autoShare) _autoShare(autoShare),
_passwordRequired(false)
{ {
_ui->setupUi(this); _ui->setupUi(this);
@ -116,6 +117,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account,
// If password is enforced then don't allow users to disable it // If password is enforced then don't allow users to disable it
if (_account->capabilities().sharePublicLinkEnforcePassword()) { if (_account->capabilities().sharePublicLinkEnforcePassword()) {
_ui->checkBox_password->setEnabled(false); _ui->checkBox_password->setEnabled(false);
_passwordRequired = true;
} }
// If expiredate is enforced do not allow disable and set max days // If expiredate is enforced do not allow disable and set max days
@ -234,7 +236,8 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
_ui->widget_shareLink->show(); _ui->widget_shareLink->show();
_ui->checkBox_shareLink->setChecked(true); _ui->checkBox_shareLink->setChecked(true);
_ui->checkBox_password->setEnabled(true); _ui->checkBox_password->setEnabled(!_passwordRequired);
if (_share->isPasswordSet()) { if (_share->isPasswordSet()) {
_ui->lineEdit_password->setEnabled(true); _ui->lineEdit_password->setEnabled(true);
_ui->checkBox_password->setChecked(true); _ui->checkBox_password->setChecked(true);
@ -410,6 +413,7 @@ void ShareLinkWidget::slotCreateShareFetched(const QSharedPointer<LinkShare> sha
void ShareLinkWidget::slotCreateShareRequiresPassword() void ShareLinkWidget::slotCreateShareRequiresPassword()
{ {
// there needs to be a password // there needs to be a password
_pi_editing->stopAnimation();
_ui->checkBox_password->setChecked(true); _ui->checkBox_password->setChecked(true);
_ui->checkBox_password->setEnabled(false); _ui->checkBox_password->setEnabled(false);
_ui->checkBox_password->setText(tr("Public sh&aring requires a password")); _ui->checkBox_password->setText(tr("Public sh&aring requires a password"));
@ -419,6 +423,8 @@ void ShareLinkWidget::slotCreateShareRequiresPassword()
_ui->checkBox_expire->setEnabled(false); _ui->checkBox_expire->setEnabled(false);
_ui->checkBox_editing->setEnabled(false); _ui->checkBox_editing->setEnabled(false);
_passwordRequired = true;
slotCheckBoxPasswordClicked(); slotCheckBoxPasswordClicked();
} }

View file

@ -107,6 +107,7 @@ private:
bool _resharingAllowed; bool _resharingAllowed;
bool _isFile; bool _isFile;
bool _autoShare; bool _autoShare;
bool _passwordRequired;
}; };
} }