CleverStack / angular-seed

The AngularJS based Modular Frontend for CleverStack, MEAN and so much more
http://youtube.com/watch?v=-4ArURHExhQ
MIT License
118 stars 36 forks source link

Auth directive #11

Closed leostera closed 11 years ago

leostera commented 11 years ago

Make a ng-authorized directive that can be used to protect a view from an unauthorized/unauthenticated user. It should make available for the template the user data.

ng-authorized(options)
  h3 Welcome {{user.name}}!

It'll take an options object (or an empty object, meaning that any user that is logged in will have acces to it) to help filter which sections are available to which users.

If the user has no access it would redirect him to a login url. This should be configurable somewhere, I'm thinking this should be part of the "SessionService". If we are going full RESTful, it should be AuthService and it should be part of the AuthService we already have in place that uses http interceptors.

This is just an idea, @pilsy, @simonwjackson if you have anything to add/say here please do.