0

I'm using the stack mean.js for a customer.

I would like to create a community Web platform. My customer would like he could seize things in the database. It is thus necessary that I created an admin panel only by himself.

I've saw that : how meanjs implement admin dashboard

The First solution seems to suit but does not work with meanJs 4.0, generators are not any more even. Somebody can he tell me how I can make to convert the solution on mean 4.0. Or if it exist another solution.

Thank you for any help or comment. Please excuse me for my bad English and have a nice day.

Community
  • 1
  • 1

2 Answers2

2

I believe you are asking how to perform authentication with the MEAN stack. Which is a little bit vague for an SO question.. but maybe these links can help get you started.

Authentication would allow you to restrict access on certain views. For example, only your client can access the administrator portal. Here are some basic guides on authentication with MEAN (though there are a lot more resource out there):

If you are using Express Routing this is pretty easy. Here is a very basic example on scotch.io: https://scotch.io/tutorials/route-middleware-to-check-if-a-user-is-authenticated-in-node-js

If you are doing a single page application (SPA) with Angular Routing: http://www.sitepoint.com/implementing-authentication-angular-applications/

fqhv
  • 1,191
  • 1
  • 13
  • 25
  • Thank you for the answer, I've already an authentication working. I want use the admin role of a user for display an "admin panel" for this user. In mean here is what i have in the user shema : roles: { type: [{ type: String, enum: ['user', 'admin'] }], default: ['user'], required: 'Please provide at least one role' }, idon't know how to setup this role and how filter user by roles. – Julien Cauchon Apr 15 '16 at 20:32
1

From the tags I assume you are using meanjs stack. You have to signup as user first. Then you need to access your mongodb database add the user role manually by adding "admin" to the roles of the user.Then you will we able to see the list of users which is part of the admin.

As a beginner I would recommend using robomongo which has a nice UI to manipulate your database.

The simplest way to get the list of users would be change the default role to "admin"

Rengas
  • 593
  • 1
  • 6
  • 25