How to use the ember-can.computed.ability function in ember-can

To help you get started, we’ve selected a few ember-can examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github minutebase / ember-can / tests / dummy / app / controllers / index.js View on Github external
author: 42,
  title: "Something"
});

let otherPost = Post.create({
  author: 99,
  title: "Something Else"
});

let bob = Person.create({
  id: 69,
  name: "Bob"
});

export default Controller.extend({
  ability:      computed.ability("post"),
  canWritePost: alias("ability.canWrite"),
  post: editablePost,

  bob: bob,
  foo: false,

  actions: {
    selectEditable: function() {
      this.set("post", editablePost);
    },
    selectOther:    function() {
      this.set("post", otherPost);
    }
  }
});

ember-can

Simple authorization addon for Ember apps

MIT
Latest version published 25 days ago

Package Health Score

77 / 100
Full package analysis