Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Controls UI element visibility and feature access through role-based permissions in ng-alain Angular applications using @delon/acl.
68% 91%+23 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 15 of 22 without it.
3 of 3 safety checks passed
Not used yet
Trigger patterns: "ACL", "permission", "role", "access control", "@delon/acl", "can", "ability"
@delon/acl provides a role-based access control (RBAC) system for ng-alain applications, controlling UI element visibility and feature access based on user roles and permissions.
Package: @delon/[email protected]
Integrated with: @delon/auth for authentication
import { inject } from '@angular/core';
import { ACLService } from '@delon/acl';
@Component({
selector: 'app-dashboard',
standalone: true
})
export class DashboardComponent {
private aclService = inject(ACLService);
ngOnInit(): void {
// Set user roles and permissions
this.aclService.setRole(['admin', 'user']);
this.aclService.setAbility(['task:create', 'task:edit', 'task:delete']);
// Set full ACL configuration
this.aclService.set({
role: ['admin'],
ability: ['task:create', 'task:edit'],
mode: 'oneOf' // 'allOf' or 'oneOf'
});
}
canEditTask(): boolean {
Next to this one in the catalogue, plus more from the same author.