{"id":15184609,"url":"https://github.com/g-sari/ngx-auto-disable-forms","last_synced_at":"2026-03-03T06:32:51.765Z","repository":{"id":65458850,"uuid":"131306587","full_name":"g-sari/ngx-auto-disable-forms","owner":"g-sari","description":"Disables input elements on demand","archived":false,"fork":false,"pushed_at":"2018-11-30T13:34:19.000Z","size":3100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-18T06:23:53.250Z","etag":null,"topics":["angular","angular-2","angular-cli","angular-components","angular-material","angular2","angular4","angular5","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g-sari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T14:25:00.000Z","updated_at":"2018-11-30T13:34:21.000Z","dependencies_parsed_at":"2023-01-24T14:45:29.058Z","dependency_job_id":null,"html_url":"https://github.com/g-sari/ngx-auto-disable-forms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/g-sari/ngx-auto-disable-forms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-sari%2Fngx-auto-disable-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-sari%2Fngx-auto-disable-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-sari%2Fngx-auto-disable-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-sari%2Fngx-auto-disable-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g-sari","download_url":"https://codeload.github.com/g-sari/ngx-auto-disable-forms/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g-sari%2Fngx-auto-disable-forms/sbom","scorecard":{"id":415801,"data":{"date":"2025-08-11","repo":{"name":"github.com/g-sari/ngx-auto-disable-forms","commit":"2ac1e215507b27c430e71525d213b76b1eef5225"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/19 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T23:49:44.650Z","repository_id":65458850,"created_at":"2025-08-18T23:49:44.650Z","updated_at":"2025-08-18T23:49:44.650Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30034077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:09:21.518Z","status":"ssl_error","status_checked_at":"2026-03-03T06:08:47.858Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-2","angular-cli","angular-components","angular-material","angular2","angular4","angular5","typescript"],"created_at":"2024-09-27T17:21:00.190Z","updated_at":"2026-03-03T06:32:51.721Z","avatar_url":"https://github.com/g-sari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ngx-auto-disable-forms\nThis module checks roles and permissions of the current signed in user and disables input fields on demand automatically. That means you don't have to disable each form input field individually. Currently supports: buttons, input fields, text areas, checkboxes, selects.\n\n# Demo\n![ngx-auto-disable-forms-demo](ngx-auto-disable-forms-demo.gif)\n\n# Getting started\n\n## Installation\n```javascript\nnpm i ngx-auto-disable-forms --save\n```\n\n## Import\nJust import the module **'NgxAutoDisableFormsModule'** in your **'app.module.ts'** file.\ni.e. \n```javascript\nimport { NgxAutoDisableFormsModule } from 'ngx-auto-disable-forms';\n\n@NgModule({\n  imports: [\n      NgxAutoDisableFormsModule\n  ],\n})\n```\n\n## Interface Implementation\nGo to your component, where fields should be disabled. And implement the interface **'OnRolesAndPermissions'** i.e.\n```javascript\n@Component({\n  selector: 'test-component',\n  templateUrl: './test.component.html',\n  styleUrls: ['./test.component.scss'],\n})\nexport class TestComponent implements OnRolesAndPermissions {\n\n  /**\n   * @override\n   * Checks if the view should be displayed in read only mode.\n   *\n   * @returns if true, the view's input form fields are disabled.\n   */\n  isViewReadOnly(): boolean {\n      return true; // depends on roles and permissions\n  }\n\n}\n```\n\n## Template\nNote that you need to add the attribute **'rolesAndPermissionsRelatedContent'** to the div container inside of the components template. \nDepending on roles an permissions all UI input fields inside the div will be disabled automatically.\ni.e. \n```javascript\n\u003cdiv rolesAndPermissionsRelatedContent\u003e\n...\nyour form inputs\n...\n\u003c/div\u003e\n```\n\nIf needed you can also exclude some input fields from being disabled by adding the css class **'exclude-from-roles-and-permissions'**\ni.e. \n```javascript\n\u003cbutton class=\"exclude-from-roles-and-permissions\"\u003e\u003c/button\u003e\n```\n\n## Optional\nIf you want you can provide a roles and permission service, to do this create a service and implement the service **'RolesAndPermissionsServiceInterface\u003cT\u003e'**\n```javascript\nimport { Injectable, Inject } from '@angular/core';\nimport { RolesAndPermissionsServiceInterface } from 'ngx-auto-disable-forms';\n\n@Injectable()\nexport class UserRolesAndPermissionsService implements RolesAndPermissionsServiceInterface\u003cUserModel\u003e {\n\n  constructor(private userRolesService: UserRolesService) { }\n\n  hasOnlyReadPermissions(user: UserModel): boolean {\n      return this.userRolesService.hasOnlyReadPermissions(user);\n  }\n\n  isAuthorized(user: UserModel): boolean {\n      return this.userRolesService.isUserAuthorized(user);\n  }\n\n  hasWritePermissions(user: UserModel): boolean {\n      return this.userRolesService.hasWritePermissions(user);\n  }\n\n}\n```\n\nAdditionally you need to provide the service in the **'app.module.ts'** file\n```javascript\nimport { NgxAutoDisableFormsModule, RolesAndPermissionsService } from 'ngx-auto-disable-forms';\n\n@NgModule({\n  imports: [\n      NgxAutoDisableFormsModule\n  ],\n  providers: [\n    // optional\n      UserRolesAndPermissionsService, \n      {\n          provide: RolesAndPermissionsService,\n          useExisting: UserRolesAndPermissionsService\n      },\n  ]\n})\n```\n\nNow you can use your service in your component\n```javascript\n@Component({\n  selector: 'test-component',\n  templateUrl: './test.component.html',\n  styleUrls: ['./test.component.scss'],\n})\nexport class TestComponent implements OnRolesAndPermissions {\n\n  constructor(private userRolesAndPermissionsService: UserRolesAndPermissionsService) {}\n\n  /**\n   * @override\n   * Checks if the view should be displayed in read only mode.\n   *\n   * @returns if true, the view's input form fields are disabled.\n   */\n  isViewReadOnly(): boolean {\n      return this.userRolesAndPermissionsService.hasOnlyReadPermissions(this.currentUser);\n  }\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-sari%2Fngx-auto-disable-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg-sari%2Fngx-auto-disable-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg-sari%2Fngx-auto-disable-forms/lists"}