Page MenuHomePhorge

Fix blocking access to some APIs
ClosedPublic

Authored by machniak on May 19 2023, 3:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 10, 10:45 AM
Unknown Object (File)
Thu, Jul 4, 1:34 AM
Unknown Object (File)
Jun 26 2024, 4:21 PM
Unknown Object (File)
Jun 20 2024, 3:08 PM
Unknown Object (File)
Jun 16 2024, 7:58 AM
Unknown Object (File)
Jun 14 2024, 11:17 AM
Unknown Object (File)
Jun 11 2024, 11:41 PM
Unknown Object (File)
Jun 10 2024, 5:38 AM
Subscribers
Restricted Project

Details

Reviewers
None
Group Reviewers
Restricted Project
Commits
rKdd0613b1c65c: Fix blocking access to some APIs
Summary

Non-controller users cannot change their own config, email aliases and subscriptions.

Test Plan

./phpunit

Diff Detail

Repository
rK kolab
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

machniak created this revision.
mollekopf added inline comments.
src/app/Http/Controllers/API/V4/UsersController.php
302โ€“304

It's a pure style issue, but I really don't like using strings where it can be avoided:

This could just be written as:

$canExecuteModification = $requires_controller ? $current_user->canDelete($user) : $current_user->canUpdate($user);

or a variation thereof.

It's IMO easier to read (I know, subjective), but it also allows typecheckers/linters/autocompletion etc to function.

Obviously not a blocker.

src/app/Http/Controllers/RelationController.php
294โ€“296

This seems like an indirect check. Non-controllers cannot delete, therefore we use this to check if they can modify the config here. I think it would be better to have an explicit isController check, or at least supply a comment what we mean to be checking here.

This revision was not accepted when it landed; it landed in state Needs Review.May 23 2023, 8:49 AM
This revision was automatically updated to reflect the committed changes.