updates
This commit is contained in:
@@ -31,7 +31,7 @@ class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
public function settings()
|
public function settings()
|
||||||
{
|
{
|
||||||
if (auth()->user()->isAdmin()) {
|
if (auth()->user()->isInstanceAdmin()) {
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
return view('settings.configuration', [
|
return view('settings.configuration', [
|
||||||
'settings' => $settings
|
'settings' => $settings
|
||||||
@@ -42,7 +42,7 @@ class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
public function emails()
|
public function emails()
|
||||||
{
|
{
|
||||||
if (auth()->user()->isAdmin()) {
|
if (auth()->user()->isInstanceAdmin()) {
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
return view('settings.emails', [
|
return view('settings.emails', [
|
||||||
'settings' => $settings
|
'settings' => $settings
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ use Livewire\Component;
|
|||||||
class Member extends Component
|
class Member extends Component
|
||||||
{
|
{
|
||||||
public User $member;
|
public User $member;
|
||||||
public function render()
|
public function remove()
|
||||||
{
|
{
|
||||||
return view('livewire.team.member');
|
$this->member->teams()->detach(session('currentTeam'));
|
||||||
|
session(['currentTeam' => session('currentTeam')->fresh()]);
|
||||||
|
$this->emit('reloadWindow');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ class User extends Authenticatable
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
public function isAdmin()
|
public function isAdmin()
|
||||||
|
{
|
||||||
|
ray(session('currentTeam'));
|
||||||
|
return session('currentTeam');
|
||||||
|
}
|
||||||
|
public function isInstanceAdmin()
|
||||||
{
|
{
|
||||||
$found_root_team = auth()->user()->teams->filter(function ($team) {
|
$found_root_team = auth()->user()->teams->filter(function ($team) {
|
||||||
if ($team->id == 0) {
|
if ($team->id == 0) {
|
||||||
@@ -49,10 +54,10 @@ class User extends Authenticatable
|
|||||||
return $this->belongsToMany(Team::class);
|
return $this->belongsToMany(Team::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function currentTeam()
|
// public function currentTeam()
|
||||||
{
|
// {
|
||||||
return $this->belongsTo(Team::class);
|
// return $this->belongsTo(Team::class);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public function otherTeams()
|
public function otherTeams()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ class TeamSeeder extends Seeder
|
|||||||
'name' => 'Normal Team',
|
'name' => 'Normal Team',
|
||||||
'personal_team' => true,
|
'personal_team' => true,
|
||||||
]);
|
]);
|
||||||
|
// $root_user->teams()->attach($root_user_personal_team);
|
||||||
|
// $root_user->teams()->attach($root_user_other_team);
|
||||||
|
// $normal_user->teams()->attach($normal_user_personal_team);
|
||||||
|
// $normal_user->teams()->attach($root_user_personal_team);
|
||||||
DB::table('team_user')->insert([
|
DB::table('team_user')->insert([
|
||||||
'team_id' => $root_user_personal_team->id,
|
'team_id' => $root_user_personal_team->id,
|
||||||
'user_id' => $root_user->id,
|
'user_id' => $root_user->id,
|
||||||
@@ -35,17 +39,14 @@ class TeamSeeder extends Seeder
|
|||||||
DB::table('team_user')->insert([
|
DB::table('team_user')->insert([
|
||||||
'team_id' => $root_user_other_team->id,
|
'team_id' => $root_user_other_team->id,
|
||||||
'user_id' => $root_user->id,
|
'user_id' => $root_user->id,
|
||||||
'role' => 'admin',
|
|
||||||
]);
|
]);
|
||||||
DB::table('team_user')->insert([
|
DB::table('team_user')->insert([
|
||||||
'team_id' => $normal_user_personal_team->id,
|
'team_id' => $normal_user_personal_team->id,
|
||||||
'user_id' => $normal_user->id,
|
'user_id' => $normal_user->id,
|
||||||
'role' => 'admin',
|
|
||||||
]);
|
]);
|
||||||
DB::table('team_user')->insert([
|
DB::table('team_user')->insert([
|
||||||
'team_id' => $root_user_personal_team->id,
|
'team_id' => $root_user_personal_team->id,
|
||||||
'user_id' => $normal_user->id,
|
'user_id' => $normal_user->id,
|
||||||
'role' => 'admin',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
@endif
|
@endif
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<select {{ $attributes }} wire:model.defer={{ $id }}>
|
<select {{ $attributes }}
|
||||||
|
@if ($id) name={{ $id }} wire:model.defer={{ $id }} @endif>
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
@if (auth()->user()->isAdmin())
|
@if (auth()->user()->isInstanceAdmin())
|
||||||
<li title="Command Center">
|
<li title="Command Center">
|
||||||
<a class="hover:bg-transparent" @if (!request()->is('command-center')) href="/command-center" @endif>
|
<a class="hover:bg-transparent" @if (!request()->is('command-center')) href="/command-center" @endif>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg"
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|||||||
@@ -10,6 +10,5 @@
|
|||||||
<button>Emails</button>
|
<button>Emails</button>
|
||||||
</a>
|
</a>
|
||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
<livewire:switch-team />
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<x-forms.button type="submit">
|
<x-forms.button type="submit">
|
||||||
Save
|
Save
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@if (auth()->user()->isAdmin())
|
@if (auth()->user()->isInstanceAdmin())
|
||||||
<x-forms.button wire:click='copySMTP'>
|
<x-forms.button wire:click='copySMTP'>
|
||||||
Copy from Instance Settings
|
Copy from Instance Settings
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<x-forms.textarea id="value" rows="10" placeholder="-----BEGIN OPENSSH PRIVATE KEY-----"
|
<x-forms.textarea id="value" rows="10" placeholder="-----BEGIN OPENSSH PRIVATE KEY-----"
|
||||||
label="Private Key" required />
|
label="Private Key" required />
|
||||||
<x-forms.button type="submit" wire.click.prevent>
|
<x-forms.button type="submit">
|
||||||
Save Private Key
|
Save Private Key
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="w-64 -mt-9">
|
<div class="w-64 -mt-9">
|
||||||
<x-forms.select id="selectedTeamId" class="pr-0 select-xs ">
|
<x-forms.select wire:model="selectedTeamId" class="pr-0 select-xs ">
|
||||||
<option value="default" disabled selected>Switch team</option>
|
<option value="default" disabled selected>Switch team</option>
|
||||||
@foreach (auth()->user()->teams as $team)
|
@foreach (auth()->user()->teams as $team)
|
||||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||||
|
|||||||
@@ -3,8 +3,15 @@
|
|||||||
<td>{{ $member->name }}</td>
|
<td>{{ $member->name }}</td>
|
||||||
<td>{{ $member->email }}</td>
|
<td>{{ $member->email }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
{{-- @if (auth()->user()->isAdmin())
|
||||||
|
<x-forms.button wire:click="makeAdmin">Make admin</x-forms.button>
|
||||||
|
@else
|
||||||
|
<x-forms.button disabled>Make admin</x-forms.button>
|
||||||
|
@endif --}}
|
||||||
@if ($member->id !== auth()->user()->id)
|
@if ($member->id !== auth()->user()->id)
|
||||||
<x-forms.button class="border-none">Remove</x-forms.button>
|
<x-forms.button wire:click="remove">Remove</x-forms.button>
|
||||||
|
@else
|
||||||
|
<x-forms.button disabled>Remove</x-forms.button>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<x-settings.navbar />
|
<x-settings.navbar />
|
||||||
<livewire:settings.configuration :settings="$settings" />
|
<livewire:settings.configuration :settings="$settings" />
|
||||||
|
|
||||||
@if (auth()->user()->isAdmin())
|
@if (auth()->user()->isInstanceAdmin())
|
||||||
<livewire:force-upgrade />
|
<livewire:force-upgrade />
|
||||||
@endif
|
@endif
|
||||||
</x-layout>
|
</x-layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user