fix: admins should now invite owner

This commit is contained in:
Andras Bacsai
2024-10-24 20:57:30 +02:00
parent 091cbdf048
commit 8182305ac4
2 changed files with 7 additions and 2 deletions

View File

@@ -41,6 +41,9 @@ class InviteLink extends Component
{
try {
$this->validate();
if (auth()->user()->role() === 'admin' && $this->role === 'owner') {
throw new \Exception('Admins cannot invite owners.');
}
$member_emails = currentTeam()->members()->get()->pluck('email');
if ($member_emails->contains($this->email)) {
return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of ".currentTeam()->name.'.');

View File

@@ -2,7 +2,9 @@
<div class="flex flex-1 gap-2">
<x-forms.input id="email" type="email" label="Email" name="email" placeholder="Email" required />
<x-forms.select id="role" name="role" label="Role">
@if (auth()->user()->role() === 'owner')
<option value="owner">Owner</option>
@endif
<option value="admin">Admin</option>
<option value="member">Member</option>
</x-forms.select>