Skip to content

Instantly share code, notes, and snippets.

View pappu687's full-sized avatar

Md. Mahbubur Rahman pappu687

View GitHub Profile
@pappu687
pappu687 / overview-for-angular-apps-with-roles-and-permissions.md
Created May 1, 2016 08:56 — forked from bvaughn/overview-for-angular-apps-with-roles-and-permissions.md
RE: Reddit Angular JS question "Advice on separating the logical parts of an application"

This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.

There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...

A local session service

First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.

Let's assume yo

@pappu687
pappu687 / 0_reuse_code.js
Created April 14, 2014 15:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console