May EmberNati: Mitch Lloyd on Authentication and Authorization with Ember
Why Stack Overflow recommends it
Stack Overflow users link it when answering Ember questions about ACLs and permissions, since it shows the backend sending a policy object that templates simply check with an if.
Recommended by 3 people across 3 different months, 2014 to 2015.
What it is
A 2014 EmberNati meetup talk by Mitch Lloyd of Launch Scout on handling authentication and authorization in Ember.js using only vanilla Ember and no libraries. He argues the approach is declarative and avoids duplicating logic between client and server.
What people said
Recommends MilkyWayJoe · 2014-10 · Stack Overflow · on “Ember Simple-Auth with API for LDAP”
this is the exact opposite of what you're asking since it doesn't deal with simple-auth, but there's a little bit about the csrf service he proposes that perhaps you could take in the concepts: [this video]
Recommends Martin Samson · 2014-11 · Stack Overflow · on “How to verify ACL in a template”
This talk [this video] ( linked by MilkyWayJoe [LINK] ) explains a really simple way to setup authentication / ACL. The session object ( or each API response ) could contain a Policy object that contains true / false values. Template {{#if session.policy.canCreateItems}}{{link-to 'New Item' 'items.new'}}{{/if}} {{#if item.policy.canEdit}}{{link-to 'Edit' 'items.edit' item}}{{/if}} Authenticator ( if using ember-simple-auth ) var session = { userId: response.user_id, policy: {} }; for(var p in response.policy) { if (response.policy.hasOwnProperty(p)) { session.policy[p.camelize()] = response.policy[p]; } } API responses { "items": [{ ... policy: { can_delete: true, can_view: true, can_edit: true }
Recommends Dejan Biljecki · 2015-02 · Stack Overflow · on “Building A Social Network”
If I understand you: [this video] at around 4:00 this guy talks about keeping that logic in the backend, while all the front end does is show or hide certain elements based on that data (something like {{#if user.canUpload}} link to uploads {{/if}}
Cites Martin Samson · 2014-11 · Stack Overflow · on “How to verify ACL in a template”
Thanks for your answer. After evaluating the different options I went with something close to the talk @MilkyWayJoe ( [this video] ) linked. The session object holds a `policy` hash with `canDeleteItem` and the template evaluates with a simple if: `{{#if session.policy.canDeleteItem}}{{/if}}`. The `policy` object could contain helper functions.