Tsahi
Tsahi

Reputation: 455

handle permissions with backbone

I'm building a new project with backbone and I was wondering what is the best approach to handle user's permissions with it. e.g. if I want that for some users a specific control will not be rendered. where the logic for it should be? I was thinking maybe checking this on the initialize function of the View and wrapping the render function with it. what would you do?

Upvotes: 5

Views: 1564

Answers (2)

danikoren
danikoren

Reputation: 4301

All security tasks like authorization and authentication should be managed by the server. It's so easy to bypass them in the client, making all auth/acl operations in client irrelevant. Use session and cookies to manage this via server implementation.

see the userSession.js file here

Upvotes: 0

Alexander Beletsky
Alexander Beletsky

Reputation: 19841

I would refer you to Addy Osmany's Large Scale Javascript paper. He describes the idea of Facade which is also responsible for handling permissions.

The aura project intended to apply this concept, but for now the permissions feature is missing there, as for me.

Upvotes: 1

Related Questions