
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Ember addon for CASL which makes it easy to add permissions in any Ember application
Ember addon for CASL which makes it easy to add permissions in any Ember application.
This package allows to integrate @casl/ability with Ember application.
It provides:
ember install ember-casl
Define ability like regular Ember services by extending AbilityService.
// services/post-ability.js
import { tracked } from '@glimmer/tracking';
import AbilityService from 'ember-casl/services/ability';
export default class PostAbility extends AbilityService {
@tracked isWriter = false;
get definition() {
return ({ can, cannot }) => {
can('read', 'post');
if (this.isWriter) {
can('write', 'post');
} else {
cannot('write', 'post').because("You're not a writer");
}
};
}
}
The definition getter should return a function taking destructured AbilityBuilder as argument (build excluded).
It allows you to define very complex reactive ability (eg. Ability based on tracked property or another service).
Your newly created Ability service expose some fields
| Name | Type | Description |
|---|---|---|
ability | CASL Ability | Original CASL Ability |
can | Method | Wrapper on CASL Ability method can |
cannot | Method | Wrapper on CASL Ability method cannot |
relevantRuleFor | Method | Wrapper on CASL Ability method relevantRuleFor |
Then you can use those abilities as regular services in your Ember application.
// components/dummy.js
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class Dummy Component extends Component {
@service postAbility;
get canRead() {
return this.postAbility.can('read', 'post');
}
get cannotWriteReason() {
return this.postAbility.relevantRuleFor('read', 'post').reason;
}
}
You can use can & cannot helpers in your templates.
{{#if (can 'read' 'post' service='post-ability')}}
<span>You're a reader</span>
{{/if}}
{{#if (cannot 'write' 'post' service='post-ability')}}
<span>You're not a writer</span>
{{/if}}
Positional params are CASL Ability can / cannot arguments.
service is the name of the Ember service.
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Ember addon for CASL which makes it easy to add permissions in any Ember application
We found that ember-casl 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.