Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
ngx-roles-selector
Advanced tools
An Angular Component that allows the user to select multiple roles of interest from a list of specified roles, separated by different permissions name.
An Angular Component that allows the user to select multiple roles of interest from a list of specified roles, separated by different permissions name.
After installing the above dependencies. Install ngx-roles-selector via.
npm i ngx-roles-selector
Once installed you need to import our main module in your application module:
import { RolesSelectorModule } from 'ngx-roles-selector';
@NgModule({
declarations: [AppComponent, ...],
imports: [RolesSelectorModule, ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
ngx-roles-selector.
<form [formGroup]="form">
....
<ngx-roles-selector
[formArrayName]="'roles'"
[roleList]="roleList"
[form]="form"
[permittedRoles] = "permittedRoles"
[permissions] = "permissions"
[showTags] = "true"
>
</ngx-roles-selector >
....
</form>
Create your form in the component ts file. Inside the constructor of your component.ts file create a form with empty roles formarray via
constructor(
private fb: FormBuilder
) {
this.form = this.fb.group({
roles: this.fb.array([])
})
}
Make sure to import missing FormBuilder import.
Declare and initialize roleList property sample:
roleList: any[] = [
{
name: "Inventory",
},
{
name: "Tasks"
},
{
name: "Payroll"
},
{
name: "Users"
},
{
name: "Workflow"
},
{
name: "Requisition"
},
{
name: "Employees"
}
]
Declare and initialize permissions property, sample:
permissions = ['read', 'write', 'create', 'delete',"export","import"]
Declare and initialize existing roles and permissions if available, sample:
permittedRoles = [
{
name: "Payroll",
read: true,
write: true,
create: true,
delete: true,
export: true,
import: true,
},
]
Finnaly create a get method to return roles as formarray, sample:
get roles() {
return this.form.get('roles') as FormArray;
}
FAQs
An Angular Component that allows the user to select multiple roles of interest from a list of specified roles, separated by different permissions name.
The npm package ngx-roles-selector receives a total of 1 weekly downloads. As such, ngx-roles-selector popularity was classified as not popular.
We found that ngx-roles-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.