Apply server default permissions for federated file sharing too.

See nextcloud/server#24729 comments.

Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
Camila 2021-08-25 12:06:42 +02:00 committed by Matthieu Gallien (Rebase PR Action)
parent 8f847906c6
commit df38e5c08b

View file

@ -372,40 +372,30 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
_lastCreatedShareId = QString();
if (sharee->type() == Sharee::Federated
&& _account->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) {
int permissions = SharePermissionRead | SharePermissionUpdate;
if (!_isFile) {
permissions |= SharePermissionCreate | SharePermissionDelete;
QString password;
if (sharee->type() == Sharee::Email && _account->capabilities().shareEmailPasswordEnforced()) {
_ui->shareeLineEdit->clear();
// always show a dialog for password-enforced email shares
bool ok = false;
do {
password = QInputDialog::getText(
this,
tr("Password for share required"),
tr("Please enter a password for your email share:"),
QLineEdit::Password,
QString(),
&ok);
} while (password.isEmpty() && ok);
if (!ok) {
return;
}
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermission(permissions));
} else {
QString password;
if (sharee->type() == Sharee::Email && _account->capabilities().shareEmailPasswordEnforced()) {
_ui->shareeLineEdit->clear();
// always show a dialog for password-enforced email shares
bool ok = false;
do {
password = QInputDialog::getText(
this,
tr("Password for share required"),
tr("Please enter a password for your email share:"),
QLineEdit::Password,
QString(),
&ok);
} while (password.isEmpty() && ok);
if (!ok) {
return;
}
}
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), _maxSharingPermissions, password);
}
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), _maxSharingPermissions, password);
_ui->shareeLineEdit->setEnabled(false);
_ui->shareeLineEdit->clear();
}