0

Suppose I am building a web application through which users can make and sell hot dogs. I am using EmberJS for the client.

Background:

  1. I am currently implementing authentication using Ember-Simple-Auth, which seems to be a fairly standard library to use with Ember for the purpose of signing in, having user sessions, or tokens.

  2. There are two types of users - cooks and consumers.

  3. I will have my server determining if a specific user is a cook or a eater, and then will be placing that information into a cookie in the page served to the client.

  4. I have a navbar (which is an isolated Ember Component) that will have the home button, and one more button. If the user is a cook, the Cook button must be shown, and the Consumer button will be hidden, and vice-versa if the user is a consumer.

My question is, what is the optimal/recommended way to implement these user roles with Ember Simple Auth?

TLDR: Need to authorize user to access elements in web page based on user role. What is the current recommended way to do this in EmberJS?

Tom Mathew
  • 144
  • 1
  • 11

1 Answers1

1

Check out https://github.com/minutebase/ember-can

Also I don't recommend having the server set a cookie for this. Why not just use ember simple auth (ESA) to set this in the user session? It can be passed to ESA from the server when the user logs in

David Duncan
  • 1,858
  • 17
  • 21
  • Well when the user logs in, the session is started by the server. The session variables include things like access level. Is it bad practice to leave role levels in the cookie even if it is over HTTPS? Also, yea I ended up using the "data" property of the session object. Thanks though. – Tom Mathew Sep 26 '16 at 20:40
  • It doesn't sound like you are using ESA to manage sessions then if it started by the server – David Duncan Sep 27 '16 at 15:03