ootri/laravel-permission-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ootri/laravel-permission-manager

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ootri/laravel-permission-manager

包简介

A permissions management module for Laravel apps using Spatie Permissions, Livewire, and Tailwind CSS.

README 文档

README

Overview

Ootri Permission Manager is a very simple permission and role management dashboard for spatie/laravel-permission designed to work with the TALL stack, specifically Laravel Jetstream (optional). It leverages the Spatie Laravel Permission package to provide a user-friendly interface for managing users, roles, and permissions.

While it was designed to integrate with Jetstream, it can also be used standalone within any TALL stack application or a custom dashboards.

Installation

Install via Composer:

composer require ootri/laravel-permission-manager

Usage

Option 1: Permissions already set

Add this if you've already setup permissions using spatie/laravel-permission:

Route::group(['middleware' => ['can:admin']], function () {
    Route::get('/permissions', [\Ootri\PermissionManager\Http\Controllers\PermissionManagementController::class, 'index'])->name('permissions.index');
});

Option 2: Restrict to auth/user

If you haven't yet created any permissions/roles:

// Restrict to any logged in user
Route::middleware(['auth'])->group(function () {
    Route::get('/permissions', [\Ootri\PermissionManager\Http\Controllers\PermissionManagementController::class, 'index'])->name('permissions.index');
});

// Or specify a user by email address
Route::middleware(['auth'])->group(function () {
    Route::get('/permissions', function () {
        if (\Illuminate\Support\Facades\Auth::check() && \Illuminate\Support\Facades\Auth::user()->email === 'test@domain.com') {
            return app()->call([\Ootri\PermissionManager\Http\Controllers\PermissionManagementController::class, 'index']);
        }
        abort(403, 'Unauthorized');
    })->name('permissions.index');
});

IMPORTANT: This is just temporary until admin permissions/roles are created, then change it to Option 1.

Option 3: Using Livewire Components Directly

If you prefer to integrate the permission management tools directly into an existing dashboard or custom UI, you can include the Livewire components directly in your Blade templates:

@livewire('ootri-permission-management')
@livewire('ootri-user-management')

This approach removes the dependency on Jetstream, allowing flexibility to integrate into any other app based on the TALL stack.

Features

  • User Management: Add, view, and remove users.
  • Role Management: Create, assign, and revoke roles.
  • Permission Management: Create, assign, and revoke permissions.
  • Direct User Permissions: Assign/revoke permissions directly to/from users.
  • Clear Overview: Display current assignments for users, roles, and permissions.

This package is intended to be and remain simple.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-08