简体   繁体   English

在React JS应用程序中管理角色

[英]Manage Roles in React JS application

What kind of libraries are you using for user role management in your React applications? 您在React应用程序中使用哪种库来进行用户角色管理? Any kind of directions are welcome. 任何方向的欢迎。 By role managing I am mostly reffering to showing or hiding certain components of the application. 通过角色管理,我主要是表示或隐藏应用程序的某些组件。

At the simplest level, I would think you would just reflect the user role in your state, and have components render (or not) accordingly. 在最简单的层次上,我认为您将只反映您状态中的用户角色,并相应地渲染(或不渲染)组件。

If you want to completely hide the existence of privileged code from a non-privileged user, you may need to factor common code into a shared library between user and admin apps, or generate two separate bundles, and authenticate access to the bundles. 如果要完全向非特权用户隐藏特权代码的存在,则可能需要将公共代码分解为用户和管理应用程序之间的共享库,或生成两个单独的捆绑软件,并验证对捆绑软件的访问权限。

Either way, the important thing is that you securely authenticate requests that would change server state in privileged ways. 无论哪种方式,重要的是您可以安全地验证将以特权方式更改服务器状态的请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM