fix(workflows): Finish password confirmation

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/41520/head
Joas Schilling 2 years ago
parent 50f8d6c129
commit d8ffbed2c2
No known key found for this signature in database
GPG Key ID: 74434EFE0D2E2205
  1. 4
      apps/workflowengine/lib/Controller/AWorkflowController.php
  2. 4
      apps/workflowengine/lib/Controller/UserWorkflowsController.php
  3. 7
      apps/workflowengine/src/store.js

@ -30,6 +30,7 @@ namespace OCA\WorkflowEngine\Controller;
use Doctrine\DBAL\Exception;
use OCA\WorkflowEngine\Helper\ScopeContext;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSException;
@ -103,6 +104,7 @@ abstract class AWorkflowController extends OCSController {
* @throws OCSForbiddenException
* @throws OCSException
*/
#[PasswordConfirmationRequired]
public function create(
string $class,
string $name,
@ -131,6 +133,7 @@ abstract class AWorkflowController extends OCSController {
* @throws OCSForbiddenException
* @throws OCSException
*/
#[PasswordConfirmationRequired]
public function update(
int $id,
string $name,
@ -159,6 +162,7 @@ abstract class AWorkflowController extends OCSController {
* @throws OCSForbiddenException
* @throws OCSException
*/
#[PasswordConfirmationRequired]
public function destroy(int $id): DataResponse {
try {
$deleted = $this->manager->deleteOperation($id, $this->getScopeContext());

@ -29,6 +29,7 @@ namespace OCA\WorkflowEngine\Controller;
use OCA\WorkflowEngine\Helper\ScopeContext;
use OCA\WorkflowEngine\Manager;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSForbiddenException;
@ -84,6 +85,7 @@ class UserWorkflowsController extends AWorkflowController {
* @throws OCSBadRequestException
* @throws OCSForbiddenException
*/
#[PasswordConfirmationRequired]
public function create(string $class, string $name, array $checks, string $operation, string $entity, array $events): DataResponse {
return parent::create($class, $name, $checks, $operation, $entity, $events);
}
@ -93,6 +95,7 @@ class UserWorkflowsController extends AWorkflowController {
* @throws OCSBadRequestException
* @throws OCSForbiddenException
*/
#[PasswordConfirmationRequired]
public function update(int $id, string $name, array $checks, string $operation, string $entity, array $events): DataResponse {
return parent::update($id, $name, $checks, $operation, $entity, $events);
}
@ -101,6 +104,7 @@ class UserWorkflowsController extends AWorkflowController {
* @NoAdminRequired
* @throws OCSForbiddenException
*/
#[PasswordConfirmationRequired]
public function destroy(int $id): DataResponse {
return parent::destroy($id);
}

@ -89,7 +89,8 @@ const store = new Store({
context.commit('addRule', rule)
})
},
createNewRule(context, rule) {
async createNewRule(context, rule) {
await confirmPassword()
let entity = null
let events = []
if (rule.isComplex === false && rule.fixedEntity === '') {
@ -120,9 +121,7 @@ const store = new Store({
context.commit('removeRule', rule)
},
async pushUpdateRule(context, rule) {
if (context.state.scope === 0) {
await confirmPassword()
}
await confirmPassword()
let result
if (rule.id < 0) {
result = await axios.post(getApiUrl(''), rule)

Loading…
Cancel
Save