Get 2024 Templates Mega Bundle!19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets
Get for 99$

Metronic Access Control & Authorization


Hey, I wonder how I would add my own Login API using Axios to handle User Authorization? I also want to add Access Control so only certain users are able to see certain buttons & access certain pages. For instance, I will have admin on the same site, but I want the user to not see them anywhere, even in Web JavaScript Console.

I would really appreciate it if there is something that can help me achieve such. I've used CASL for Vue.js before, but it will let other users see the Admin Pages in the JavaScript Console (Different Admin Template than Metronic). Right now, I want to use ReactJS for this with Metronic.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hey, I do want to use my own API, no Laravel. I do want to know how I would control certain access that user views. For instance hide admin button & admin routes



Hi,

Typically, when restricting access for certain users, it's common practice to provide a flag like isAdmin or an array specifying user permissions from your server. You can then utilize this data to hide links and components for users without access. Use this flag for frontend content restriction, but do not forget to add the permission check on your backend as well.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hi,

Thank you for reaching out to us.

We do not have a user permission check functionality in our SPA applications. Please note, that our default application uses API based on Laravel.

To implement authentication with user permissions in Laravel API with React you can refer to the tutorial below:
https://blog.munafio.com/granular-permissions-with-laravel-apis-react-frontend-f5697441bb5

Please let us know if you need any additional guidance.

Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(