Skip to content

Commit e8dc701

Browse files
committed
wip: docs
1 parent 2227176 commit e8dc701

File tree

2 files changed

+58
-86
lines changed

2 files changed

+58
-86
lines changed

docs/core/ControlPanel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ InspireCMS comes with several dashboard widgets:
189189

190190
- **Content Page Overview**: Shows content statistics and quick links
191191
- **Page Activity**: Displays recent content changes
192+
- **User Activity**: Display current user activities
192193
- **CMS Info**: Shows system information and version
193194
- **Template Info**: Provides information about available templates
194195
- **Tree Navigation**: Visual navigation builder

docs/core/UserManagement.md

Lines changed: 57 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ From here you can:
4141
1. Navigate to **Users → Roles** in the admin panel
4242
2. Click **Create Role**
4343
3. Fill in the form:
44-
- **Name**: Unique identifier for the role (e.g., "Marketing")
45-
- **Guard Name**: Leave as "web" for most cases
46-
- **Permissions**: Select the permissions for this role
44+
- **Name**: Unique identifier for the role (e.g., "Marketing")
45+
- **Guard Name**: Set to "inspirecms" (this is the default guard used by InspireCMS)
46+
- **Permissions**: Select the permissions for this role
4747
4. Click **Save** to create the role
4848

4949
## Permissions System
@@ -59,35 +59,67 @@ InspireCMS uses a granular permission system that controls access to specific ac
5959
Permissions follow a standard naming convention:
6060

6161
```
62-
[action]_[resource]
62+
[resource].[action]
6363
```
6464

6565
For example:
66-
- `view_content`: Ability to view content
67-
- `create_content`: Ability to create content
68-
- `edit_settings`: Ability to modify system settings
66+
- `content.view`: Ability to view content
67+
- `content.create`: Ability to create content
68+
- `settings.update`: Ability to modify system settings
6969

7070
### Customizing Permissions
7171

72-
You can add custom permissions by extending the permission system:
72+
You can add custom permissions directly using [Spatie's Permission](https://spatie.be/docs/laravel-permission/v6/introduction) package:
7373

7474
```php
75-
use SolutionForest\InspireCms\Facades\PermissionManifest;
76-
use SolutionForest\InspireCms\DataTypes\Manifest\PermissionOption;
75+
use Spatie\Permission\Models\Permission;
7776

78-
// In a service provider
79-
public function boot()
77+
// In a service provider or seeder
78+
Permission::create(['name' => 'manage_product_inventory', 'guard_name' => 'inspirecms']);
79+
```
80+
81+
You can also create permissions in a database seeder:
82+
83+
```php
84+
use Spatie\Permission\Models\Permission;
85+
use Spatie\Permission\Models\Role;
86+
87+
class PermissionSeeder extends Seeder
8088
{
81-
PermissionManifest::addOption(
82-
new PermissionOption(
83-
name: 'manage_product_inventory',
84-
label: 'Manage Product Inventory',
85-
description: 'Allow users to manage product inventory levels'
86-
)
87-
);
89+
public function run()
90+
{
91+
// Create permissions
92+
$permissions = [
93+
'manage_product_inventory',
94+
'view_analytics',
95+
'export_reports',
96+
];
97+
98+
foreach ($permissions as $permission) {
99+
Permission::create(['name' => $permission, 'guard_name' => 'inspirecms']);
100+
}
101+
102+
// Optionally assign to existing roles
103+
$adminRole = Role::findByName('Administrator', 'inspirecms');
104+
$adminRole->givePermissionTo('manage_product_inventory');
105+
}
88106
}
89107
```
90108

109+
Run the seeder with:
110+
111+
```bash
112+
php artisan db:seed --class=PermissionSeeder
113+
```
114+
115+
### Using Permissions in Blade Templates
116+
117+
```php
118+
@if(auth()->user()->can('manage_product_inventory'))
119+
<a href="{{ route('products.inventory') }}">Manage Inventory</a>
120+
@endif
121+
```
122+
91123
## User Management
92124

93125
Access user management through:
@@ -172,60 +204,6 @@ Users can edit their own profiles through the user menu:
172204
User Menu (top-right) → Profile
173205
```
174206

175-
### Customizing User Fields
176-
177-
To add custom fields to user profiles:
178-
179-
```php
180-
use SolutionForest\InspireCms\Filament\Resources\UserResource;
181-
use Filament\Forms\Components\TextInput;
182-
183-
// In a service provider
184-
UserResource::form(function ($form) {
185-
$form->schema([
186-
// Original fields will be included automatically
187-
TextInput::make('department')
188-
->label('Department')
189-
->maxLength(100),
190-
TextInput::make('employee_id')
191-
->label('Employee ID')
192-
->maxLength(20),
193-
]);
194-
});
195-
```
196-
197-
## Activity Monitoring
198-
199-
InspireCMS tracks user activity including:
200-
201-
- Login attempts (successful and failed)
202-
- Content creation and modification
203-
- System setting changes
204-
- User management actions
205-
206-
View the activity log in:
207-
208-
```
209-
Admin Panel → Dashboard → Activity
210-
```
211-
212-
### User Login Security
213-
214-
Security features include:
215-
216-
- **IP Tracking**: Monitor login locations
217-
- **Lockout**: Temporarily block accounts after multiple failed attempts
218-
- **Session Management**: Control session lifetime and validation
219-
- **Password Policies**: Enforce strong passwords
220-
221-
## API Authentication
222-
223-
For headless CMS implementations, InspireCMS supports API authentication:
224-
225-
- Token-based authentication
226-
- Scoped API permissions
227-
- Rate limiting
228-
229207
## Custom User Authentication
230208

231209
To use a custom user provider:
@@ -239,6 +217,12 @@ To use a custom user provider:
239217
'model' => \App\Models\CustomUser::class, // Your custom user model
240218
],
241219
],
220+
//...
221+
'models' => [
222+
'fqcn' => [
223+
'user' => \App\Models\CustomUser::class,
224+
],
225+
],
242226
```
243227

244228
Ensure your custom user model implements required interfaces:
@@ -260,19 +244,6 @@ class CustomUser extends Authenticatable implements CmsUser
260244
}
261245
```
262246

263-
## User Import and Export
264-
265-
For bulk user management:
266-
267-
1. **Export Users**: Download user data in CSV/JSON format
268-
2. **Import Users**: Bulk create users from a spreadsheet
269-
270-
Access these features in:
271-
272-
```
273-
Admin Panel → Users → Import/Export
274-
```
275-
276247
## Best Practices
277248

278249
- **Principle of Least Privilege**: Give users only the permissions they need

0 commit comments

Comments
 (0)