Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Can't saave edited Profile

Paulus Yeung   ( User )

Commented 4 years ago

This is a follow up of discussion:
https://akaunting.com/forum/discussion/general/permission-settings-for-profile-only

Also refer to #1494 on Github:
https://github.com/akaunting/akaunting/pull/1494

After updated to Akaunting v2.0.16, the navBar works and you can edit your own profile but the Save button won't save your changes.

Paulus Yeung   ( User )

Commented 4 years ago

I found a fix to my question.

The problem is a 422 Unprocessable Entity on 'Roles' which is a 'Required' field. So. you need to have Read.Auth.Roles permission to Edit and Save your own Profile.

I don't want to give Read.Auth.Roles to none Admin users, The workaround is to modify two files:

1. app/Http/Requests/Auth/User.php

line 46: 'roles' => 'required',

to

'roles' => $required,

2. app/Http/Controllers/Auth/Users.php

line 173: $response['redirect'] = route('users.index');

to

if (user()->cannot('read-auth-users') && ($user->id == user()->id)) {
$response['redirect'] = route('users.edit', $user->id);
} else {
$response['redirect'] = route('users.index');
}

Please login or register to leave a response.

Showing 1 to 2 of 2 discussions