Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disabling buttons based on roles #77

Closed
ray2233 opened this issue Jun 22, 2017 · 3 comments
Closed

disabling buttons based on roles #77

ray2233 opened this issue Jun 22, 2017 · 3 comments

Comments

@ray2233
Copy link

ray2233 commented Jun 22, 2017

Hi,
I am new to Angular, my question is that if I want to disable the edit and delete button for regular 'users' and enable these buttons only for 'Admin' how would I do that? Could you send me a function for that? I would really appreciate your help

Thanks!!

@DavideViolante
Copy link
Owner

Import auth into the ts file and in the html add this to the button
[disabled]="auth.currentUser.role === 'user'"
it should work

@RonAlmog
Copy link

that will work of course. but @ray2233 , if you want a production grade system, you should also protect your api endpoints, because people might go to them directly, and not through your gui.
check this for help on how to do that: #58

@ray2233
Copy link
Author

ray2233 commented Jun 29, 2017

Great thanks!! I will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants