承接 filaforge/filament-user-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

filaforge/filament-user-manager

最新稳定版本:v1.0.0

Composer 安装命令:

composer require filaforge/filament-user-manager

包简介

User manager plugin: Manage users and generate fake users

README 文档

README

A comprehensive Filament plugin that provides advanced user management capabilities including user CRUD operations, role management, permissions, and user activity tracking.

Features

  • User Management: Complete CRUD operations for user accounts
  • Role Management: Create, edit, and assign user roles
  • Permission System: Granular permission control for different actions
  • User Profiles: Detailed user profile management and customization
  • Activity Tracking: Monitor user login history and activity logs
  • Bulk Operations: Perform actions on multiple users simultaneously
  • User Import/Export: Import users from CSV/Excel and export user data
  • Password Management: Secure password policies and reset functionality
  • User Groups: Organize users into logical groups and teams
  • Audit Logging: Comprehensive audit trail for all user operations
  • API Integration: RESTful API endpoints for user management
  • Multi-tenancy Support: Support for multi-tenant applications

Installation

1. Install via Composer

composer require filaforge/user-manager

2. Publish & Migrate

# Publish provider groups (config, views, migrations)
php artisan vendor:publish --provider="Filaforge\\UserManager\\Providers\\UserManagerServiceProvider"

# Run migrations
php artisan migrate

3. Register Plugin

Add the plugin to your Filament panel provider:

use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugin(\Filaforge\UserManager\UserManagerPlugin::make());
}

Setup

Prerequisites

Before using this plugin, ensure your system meets these requirements:

  • Laravel Installation: Laravel 10+ with proper database setup
  • Filament Panel: Configured Filament admin panel
  • Database: MySQL, PostgreSQL, or SQLite database
  • User Model: Laravel's default User model or custom user model
  • Authentication: Laravel's authentication system configured

Configuration

The plugin will automatically:

  • Publish configuration files to config/user-manager.php
  • Publish view files to resources/views/vendor/user-manager/
  • Publish migration files to database/migrations/
  • Register necessary routes and middleware

User Manager Configuration

Configure the user manager in the published config file:

// config/user-manager.php
return [
    'enabled' => env('USER_MANAGER_ENABLED', true),
    'models' => [
        'user' => \App\Models\User::class,
        'role' => \Filaforge\UserManager\Models\Role::class,
        'permission' => \Filaforge\UserManager\Models\Permission::class,
    ],
    'features' => [
        'roles' => env('USER_MANAGER_ROLES_ENABLED', true),
        'permissions' => env('USER_MANAGER_PERMISSIONS_ENABLED', true),
        'activity_logging' => env('USER_MANAGER_ACTIVITY_LOGGING', true),
        'bulk_operations' => env('USER_MANAGER_BULK_OPERATIONS', true),
        'import_export' => env('USER_MANAGER_IMPORT_EXPORT', true),
        'user_groups' => env('USER_MANAGER_USER_GROUPS', true),
    ],
    'security' => [
        'password_min_length' => env('USER_MANAGER_PASSWORD_MIN_LENGTH', 8),
        'password_requirements' => [
            'uppercase' => true,
            'lowercase' => true,
            'numbers' => true,
            'symbols' => true,
        ],
        'session_timeout' => env('USER_MANAGER_SESSION_TIMEOUT', 3600),
        'max_login_attempts' => env('USER_MANAGER_MAX_LOGIN_ATTEMPTS', 5),
        'lockout_duration' => env('USER_MANAGER_LOCKOUT_DURATION', 900),
    ],
    'notifications' => [
        'welcome_email' => env('USER_MANAGER_WELCOME_EMAIL', true),
        'password_reset' => env('USER_MANAGER_PASSWORD_RESET', true),
        'account_locked' => env('USER_MANAGER_ACCOUNT_LOCKED', true),
        'role_changed' => env('USER_MANAGER_ROLE_CHANGED', true),
    ],
    'pagination' => [
        'users_per_page' => env('USER_MANAGER_USERS_PER_PAGE', 25),
        'roles_per_page' => env('USER_MANAGER_ROLES_PER_PAGE', 20),
        'permissions_per_page' => env('USER_MANAGER_PERMISSIONS_PER_PAGE', 30),
    ],
];

Environment Variables

Add these to your .env file:

USER_MANAGER_ENABLED=true
USER_MANAGER_ROLES_ENABLED=true
USER_MANAGER_PERMISSIONS_ENABLED=true
USER_MANAGER_ACTIVITY_LOGGING=true
USER_MANAGER_BULK_OPERATIONS=true
USER_MANAGER_IMPORT_EXPORT=true
USER_MANAGER_USER_GROUPS=true
USER_MANAGER_PASSWORD_MIN_LENGTH=8
USER_MANAGER_SESSION_TIMEOUT=3600
USER_MANAGER_MAX_LOGIN_ATTEMPTS=5
USER_MANAGER_LOCKOUT_DURATION=900
USER_MANAGER_WELCOME_EMAIL=true
USER_MANAGER_PASSWORD_RESET=true
USER_MANAGER_ACCOUNT_LOCKED=true
USER_MANAGER_ROLE_CHANGED=true
USER_MANAGER_USERS_PER_PAGE=25
USER_MANAGER_ROLES_PER_PAGE=20
USER_MANAGER_PERMISSIONS_PER_PAGE=30

Usage

Accessing User Management

  1. Navigate to your Filament admin panel
  2. Look for the "User Management" menu section
  3. Access Users, Roles, and Permissions as needed

User Management

Creating Users

  1. Navigate to Users → Create User
  2. Fill in required user information
  3. Assign roles and permissions
  4. Set password or enable password reset
  5. Save the user

Editing Users

  1. Navigate to Users → Select User
  2. Modify user information as needed
  3. Update roles and permissions
  4. Change password if required
  5. Save changes

Deleting Users

  1. Navigate to Users → Select User
  2. Click Delete button
  3. Confirm deletion
  4. Handle user data cleanup

Role Management

Creating Roles

  1. Navigate to Roles → Create Role
  2. Define role name and description
  3. Assign permissions to the role
  4. Set role hierarchy if applicable
  5. Save the role

Managing Permissions

  1. Navigate to Permissions → Create Permission
  2. Define permission name and description
  3. Assign permission to roles
  4. Set permission scope and conditions
  5. Save the permission

Bulk Operations

Bulk User Actions

  1. Select multiple users from the list
  2. Choose action (activate, deactivate, delete, etc.)
  3. Confirm bulk operation
  4. Monitor operation progress

User Import/Export

  1. Import Users:

    • Prepare CSV/Excel file with user data
    • Navigate to Users → Import
    • Upload file and map columns
    • Review and confirm import
  2. Export Users:

    • Navigate to Users → Export
    • Select export format (CSV, Excel, JSON)
    • Choose fields to export
    • Download exported file

User Groups

Creating Groups

  1. Navigate to User Groups → Create Group
  2. Define group name and description
  3. Add users to the group
  4. Set group permissions
  5. Save the group

Managing Groups

  1. Edit group membership
  2. Update group permissions
  3. Monitor group activity
  4. Archive inactive groups

Troubleshooting

Common Issues

  • Users not appearing: Check user model configuration and relationships
  • Permission errors: Verify role and permission assignments
  • Migration failures: Check database connection and table structure
  • Performance issues: Optimize queries and enable caching

Debug Steps

  1. Check the plugin configuration:
php artisan config:show user-manager
  1. Verify routes are registered:
php artisan route:list | grep user-manager
  1. Check database tables:
php artisan migrate:status
php artisan db:show
  1. Test user model relationships:
php artisan tinker
$user = \App\Models\User::first();
$user->roles;
$user->permissions;
  1. Clear caches:
php artisan optimize:clear
php artisan config:clear
php artisan route:clear
  1. Check logs for errors:
tail -f storage/logs/laravel.log

User-Specific Issues

User Creation

  • Validation errors: Check required fields and validation rules
  • Duplicate emails: Verify email uniqueness constraints
  • Password issues: Check password policy requirements

Role Assignment

  • Role not found: Verify role exists and is active
  • Permission denied: Check user's role permissions
  • Hierarchy issues: Verify role hierarchy configuration

Authentication

  • Login failures: Check user status and lockout settings
  • Session issues: Verify session configuration
  • Permission errors: Check role and permission assignments

Security Considerations

Access Control

  • Role-based access: Implement proper role hierarchy
  • Permission granularity: Use specific permissions for actions
  • User isolation: Ensure users can only access appropriate data
  • Audit logging: Track all user management activities

Best Practices

  • Regularly review and update user roles and permissions
  • Implement strong password policies
  • Monitor user activity and suspicious behavior
  • Use HTTPS for secure access
  • Regular security audits of user access

Data Protection

  • Personal information: Handle user data according to privacy regulations
  • Password security: Use secure password hashing and policies
  • Session management: Implement secure session handling
  • Data retention: Define data retention and deletion policies

Performance Optimization

System Requirements

  • Database: Optimized database with proper indexing
  • Memory: Sufficient RAM for user operations
  • Storage: Fast storage for user data and logs
  • Network: Stable network for user management operations

Optimization Tips

  • Enable database query caching
  • Implement user data pagination
  • Use database indexes for frequently queried fields
  • Monitor and optimize slow queries
  • Implement user data archiving for inactive users

Caching Strategy

  • User data caching: Cache frequently accessed user information
  • Role caching: Cache role and permission data
  • Query result caching: Cache complex query results
  • Cache invalidation: Implement proper cache invalidation

Uninstall

1. Remove Plugin Registration

Remove the plugin from your panel provider:

// remove ->plugin(\Filaforge\UserManager\UserManagerPlugin::make())

2. Roll Back Migrations (Optional)

php artisan migrate:rollback
# or roll back specific published files if needed

3. Remove Published Assets (Optional)

rm -f config/user-manager.php
rm -rf resources/views/vendor/user-manager

4. Remove Package and Clear Caches

composer remove filaforge/user-manager
php artisan optimize:clear

5. Clean Up Environment Variables

Remove these from your .env file:

USER_MANAGER_ENABLED=true
USER_MANAGER_ROLES_ENABLED=true
USER_MANAGER_PERMISSIONS_ENABLED=true
USER_MANAGER_ACTIVITY_LOGGING=true
USER_MANAGER_BULK_OPERATIONS=true
USER_MANAGER_IMPORT_EXPORT=true
USER_MANAGER_USER_GROUPS=true
USER_MANAGER_PASSWORD_MIN_LENGTH=8
USER_MANAGER_SESSION_TIMEOUT=3600
USER_MANAGER_MAX_LOGIN_ATTEMPTS=5
USER_MANAGER_LOCKOUT_DURATION=900
USER_MANAGER_WELCOME_EMAIL=true
USER_MANAGER_PASSWORD_RESET=true
USER_MANAGER_ACCOUNT_LOCKED=true
USER_MANAGER_ROLE_CHANGED=true
USER_MANAGER_USERS_PER_PAGE=25
USER_MANAGER_ROLES_PER_PAGE=20
USER_MANAGER_PERMISSIONS_PER_PAGE=30

6. Data Cleanup

After uninstalling, consider:

  • Removing user management tables
  • Cleaning up user-related data
  • Removing custom user management code
  • Updating authentication configuration
  • Reviewing user access policies

Support

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This plugin is open-sourced software licensed under the MIT license.

Made with ❤️ by the Filaforge Team

统计信息

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

GitHub 信息

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

其他信息

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