-
Notifications
You must be signed in to change notification settings - Fork 48
Feat/user resource panel admin #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hefeus
wants to merge
20
commits into
4.x
Choose a base branch
from
feat/user-resource-panel-admin
base: 4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0f6baed
feat(panel-admin): UserResource com List/View/Edit e Role hierarchy
hefeus 87bada0
fix(panel-admin): restringe acesso ao painel admin por role e central…
hefeus 91d9c7b
fix(identity): não apaga address no soft delete e torna rollback seguro
hefeus ec9d5b3
fix(identity): normaliza espaços na lista de admins configurados
hefeus bc3d71e
fix(identity): garante username sem colisão no rollback de soft-deletes
hefeus 310e496
test: atualiza AddressTest pro comportamento correto de soft/force de…
hefeus 7fb9153
feat: Apenas staffs podem atualizar a role do usuario
hefeus b705e4c
test(panel-admin): corrige expectativa de troca de role por staff
hefeus a96d689
fix(identity): restringe ExternalIdentityResource a staff e compliance
hefeus 3bbab7a
refactor(identity): unifica isStaff() em Role::canManageUsers()
hefeus 71a4388
Merge branch '4.x' of https://github.com/he4rt/heartdevs.com into fea…
hefeus 187e3e7
feat(identity,panel-admin): estende UserResource com hierarquia de ro…
hefeus c4ba82c
fix(identity): torna o unique index de username parcial pra soft delete
hefeus 0bf0313
fix(identity): reconcilia usernames duplicados no rollback do índice …
hefeus 31cec5b
fix(identity,panel-admin): restringe atribuição de papéis privilegiados
hefeus 1d2b271
fix(panel-admin): restringe TrashedFilter a quem gerencia usuários
hefeus c30964b
fix(panel-admin): esconde ação de moderação de quem não pode vê-la
hefeus 7fa6124
fix(panel-admin): valida chaves de social_links antes de salvar o perfil
hefeus 42685ac
fix(panel-admin): garante o profile antes da hidratação do form de ed…
hefeus a136728
fix(identity): trunca o username antes do sufixo de duplicata no roll…
hefeus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app-modules/identity/database/migrations/2026_09_14_120000_add_deleted_at_to_users_table.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| Schema::table('users', static function (Blueprint $table): void { | ||
| $table->timestampTz('deleted_at')->nullable(); | ||
| }); | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| Schema::table('users', static function (Blueprint $table): void { | ||
| $table->dropColumn('deleted_at'); | ||
| }); | ||
| } | ||
| }; |
41 changes: 41 additions & 0 deletions
41
...entity/database/migrations/2026_09_14_200835_make_users_username_unique_index_partial.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\DB; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| /** | ||
| * Uma conta soft-deletada não pode travar o `username` pra sempre — sem | ||
| * isso, `MergeAccountsAction` (e qualquer novo cadastro) esbarra em | ||
| * "duplicate key" ao tentar reaproveitar o username de um usuário | ||
| * apenas soft-deletado. | ||
| */ | ||
| public function up(): void | ||
| { | ||
| DB::statement('ALTER TABLE users DROP CONSTRAINT users_username_unique'); | ||
| DB::statement('CREATE UNIQUE INDEX users_username_unique ON users (username) WHERE deleted_at IS NULL'); | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| DB::statement(<<<'SQL' | ||
| WITH ranked AS ( | ||
| SELECT id, ROW_NUMBER() OVER ( | ||
| PARTITION BY username | ||
| ORDER BY (deleted_at IS NULL) DESC, created_at ASC | ||
| ) AS rn | ||
| FROM users | ||
| ) | ||
| UPDATE users | ||
| SET username = LEFT(users.username, 214) || '_dup_' || users.id | ||
| FROM ranked | ||
| WHERE users.id = ranked.id AND ranked.rn > 1 | ||
| SQL); | ||
|
|
||
| DB::statement('DROP INDEX users_username_unique'); | ||
| DB::statement('ALTER TABLE users ADD CONSTRAINT users_username_unique UNIQUE (username)'); | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app-modules/identity/src/Auth/Exceptions/AccountSoftDeletedException.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace He4rt\Identity\Auth\Exceptions; | ||
|
|
||
| final class AccountSoftDeletedException extends OAuthFlowException | ||
| { | ||
| public static function make(): self | ||
| { | ||
| return new self('This account was deleted and cannot be reactivated by logging in again.'); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.