🚧 fix(association): update authorization check for project proposal based on currentPleb membership and pubkey

This commit is contained in:
fsociety
2024-10-25 12:20:08 +02:00
parent fc9d8be985
commit f297605995

View File

@@ -35,7 +35,10 @@ on([
'nostrLoggedIn' => function ($pubkey) { 'nostrLoggedIn' => function ($pubkey) {
$this->currentPubkey = $pubkey; $this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); $this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if ($this->currentPleb->id !== $this->projectProposal->einundzwanzig_pleb_id) { if (
$this->currentPleb->id !== $this->projectProposal->einundzwanzig_pleb_id
|| !in_array($this->currentPleb->npub, config('einundzwanzig.config.current_board'), true)
) {
return $this->js('alert("Du bist hierzu nicht berechtigt.")'); return $this->js('alert("Du bist hierzu nicht berechtigt.")');
} }
$this->isAllowed = true; $this->isAllowed = true;