Merge pull request #2509 from nextcloud/sudo-mode-for-app-enabling
Add sudo mode to enabling and disabling apps
This commit is contained in:
commit
7fe02702b0
|
@ -24,6 +24,13 @@
|
|||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
|
||||
if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
|
||||
$l = \OC::$server->getL10N('core');
|
||||
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!array_key_exists('appid', $_POST)) {
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
|
|
|
@ -28,6 +28,13 @@
|
|||
OC_JSON::checkAdminUser();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
|
||||
if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
|
||||
$l = \OC::$server->getL10N('core');
|
||||
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
$groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null;
|
||||
|
||||
try {
|
||||
|
|
|
@ -24,6 +24,13 @@
|
|||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
|
||||
if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
|
||||
$l = \OC::$server->getL10N('core');
|
||||
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!array_key_exists('appid', $_POST)) {
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
|
|
|
@ -24,6 +24,13 @@
|
|||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
|
||||
if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
|
||||
$l = \OC::$server->getL10N('core');
|
||||
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!array_key_exists('appid', $_POST)) {
|
||||
OC_JSON::error();
|
||||
exit;
|
||||
|
|
|
@ -262,6 +262,11 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
},
|
||||
|
||||
enableApp:function(appId, active, element, groups) {
|
||||
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.enableApp, this, appId, active, element, groups));
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
OC.Settings.Apps.hideErrorMessage(appId);
|
||||
groups = groups || [];
|
||||
|
@ -402,6 +407,11 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
},
|
||||
|
||||
uninstallApp:function(appId, element) {
|
||||
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.uninstallApp, this, appId, element));
|
||||
return;
|
||||
}
|
||||
|
||||
OC.Settings.Apps.hideErrorMessage(appId);
|
||||
element.val(t('settings','Uninstalling ....'));
|
||||
$.post(OC.filePath('settings','ajax','uninstallapp.php'),{appid:appId},function(result) {
|
||||
|
|
Loading…
Reference in New Issue