title: mean.io what's the best way to set up an admin user + admin module
body: <p>All the times I use <a href="http://www.mean.io/" rel="nofollow">http://www.mean.io/</a>
  I've got the hassle to set up an admin user + admin module
  + (if needs) manage acl</p>
  
  <p>What I do up to now:</p>
  
  <p><strong>add this rule tomodels/user.js</strong></p>
  
  <pre><code>role: {
      type: String,
      required: true,
      default: 'authoring'
  }
  </code></pre>
  
  <p><strong>set up an init.js for sign up
  the user admin like:</strong></p>
  
  <pre><code>var userData = { "name" : "User Admin", "email" : "info@mydomain.com", "username" : "admin","role" : "admin","password":"admin"};
  var user = new User(userData);
  user.provider = 'local';
  user.save(function(err) {  
      if (err) {
          console.log(err);
          process.exit();
          return;
      }
      console.log(user); 
      process.exit();
  });
  </code></pre>
  
  <p><strong>set up three folders</strong> </p>
  
  <ul>
  <li>admin</li>
  <li>default</li>
  <li>login</li>
  </ul>
  
  <p>I don't trust manage sensible data
  only client side</p>
  
  <p><strong>set up acl</strong></p>
  
  <p><strong>a simple acl both for the server and for 
  the client like:</strong> </p>
  
  <pre><code>//SERVER
  'use strict';
  
  /**
   * Generic require login routing middleware
   */
  exports.requiresLogin = function(req, res, next) {
      if (!req.isAuthenticated()) {
          return res.redirect('/signin');
      }
      next();
  };
  
  /**
   * Generic require login routing middleware
   */
  exports.apiRequiresLogin = function(req, res,next) {
      if (!req.isAuthenticated()) {
          return res.jsonp(401,{ error:'User is not authorized'});
      }
      next();
  };
  
  // Profile authorization helpers
  exports.isOwnerProfile = function(req, res, next) {
      if (req.user.role !== 'admin') {
          if (req.profile.id !== req.user.id) {
              return res.send(401, 'User is not authorized');
          }
      }
      next();
  };
  
  // User admin authorization helpers
  exports.isAdmin = function(req, res, next) {
      if (req.user.role !== 'admin') {
          return res.send(401, 'User is not authorized');
      }
      next();
  };
  
  // Article authorization helpers
  exports.requireSameAuthor = function(req, res, next) {
      if (req.post.user.id !== req.user.id) {
          return res.send(401, 'User is not authorized');
      }
      next();
  };
  //CLIENT
  .factory('Global', function($cookieStore) {
          var user = $cookieStore.get('USER');
          var _this = this;
          _this._data = {
              user: user,
              _authenticated: !!user,
              _isAdmin: (user.role==='admin'),
              isAuthenticated: function() {
                  return this._authenticated;
              },
              isAdmin: function() {
                  return this._isAdmin;
              },
              isActionDisabled:function(post){
                  if(this.isAdmin()){
                      return false;
                  }
                  return (this.user.id === post.author_id);
              }
          };
          return _this._data;
      })
  </code></pre>
  
  <p>What's the best way to set up a admin user + admin module + acl ?</p>
  
  <p>I saw in the new realise there are packages 
  can them be usefull for this ?</p>
  
  <h2>UPDATE</h2>
  
  <p>Sorry I didn't see the doc
  <a href="http://www.mean.io/#!/docs" rel="nofollow">http://www.mean.io/#!/docs</a></p>