A
A
aimpmario2016-01-15 09:05:35
Ember.js
aimpmario, 2016-01-15 09:05:35

Distribution of access rights. How to display only the desired functionality?

Good day dear EmberJS gurus.
The essence of the problem:
There is a certain system, suppose a store, in which there are 3 actors:

  • Administrator
  • Manager
  • Customer

The client can place an order or write to the support service.
Administrator, distributes responsibilities among management.
For example: This manager will process orders, this one will work with goods and catalogs, and this one will work in the support service, answer customer questions.
Actually, the question itself is how in Ember to make it so that only the functionality that is necessary for its work is displayed to the manager, and everything else is closed?
PS I thank everyone who paid attention to the issue.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Romanov, 2016-01-15
@aimpmario

Hello.
The easiest way:
1. Add a role or roles to the session object (or authorized user profile). These can be bitmasks or just a string (like 'admin').
2. Forward this object through DI to the route, controller and components.
3. In the route, check the rights and redirect if there is no access to this section, for example, this is the admin section.
4. In the templates, you check for the role, and output the appropriate interface.
It will be useful to make a sign of rights somewhere in the configs and look at it when checking rights.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question