Yii2 rbac权限控制操作步骤实例教程,yii2rbac
Yii2 rbac权限控制操作步骤实例教程,yii2rbac
本篇的主题是 rbac权限控制的详细操作步骤,注意是操作步骤哦,关于配置与rbac的搭建,我们在yii2搭建完美后台并实现rbac权限控制实例教程说的再清楚不过了。
但是,在很多人的反馈下,说是完全按照本主的步骤来的,丝毫不差,为啥菜单不显示,为啥不显示呢不显示?艾玛,最终在群里帮人调试的时候找到原因了,si分的不容易啊。原因就是你学会了搭建没学会操作啊,啊,啊,我们今天就来详细的说说这rbac的权限控制具体怎么操作!当然,大前提下是你已经按照我们上文成功搭建一套完美的后台并实现了rbac权限控制。
以创建user表并未其添加权限为例。
1、创建user表,然后噼里啪啦的创建完毕,十分的简单我们就不细说了
2、用gii生成model+curd,如果你不会操作,可以点击yii2-gii的详细操作步骤进行操作
3、我们打开路由页面 /admin/route/index 大概会出现下图的界面
如果你的左侧菜单没有出现我们上图中的/user/*系列路由,请点击其旁边的刷新按钮进行刷新。
现在我们把左侧的/user/*系列选中移动到右
4、我们打开权限界面 /admin/permission/index
点击新增权限按钮,按照下图添加名称和描述即可
点击新增,成功后会跳转到该权限的详情页面,像下图中所示,们选中/user/*系列移动到右侧
5、我们访问角色列表页面 /admin/role/index 添加角色,只填写名称和描述即可,添加成功后会跳转到角色的详情页面,然后我们按照下图只需要把权限"用户管理"移动过就行了
意思就是我们给刚刚创建的这个角色分配"用户管理"的权限,在第四步中,我们已经为"用户管理"分配了/user/*系列的权限。
6、我们访问分配页面 /admin/assignment/index 为当前用户分配刚刚添加的角色。注意是角色哦,不是Permission,不要重复添加了。
7、如果我们想要刚刚的添加的操作"用户管理"显示在菜单上,我们还需要打开菜单列表页
/admin/menu/index 点击新增菜单即可。
相关阅读:Yii2 rbac权限控制之菜单menu实例教程
到此,我们给当前用户分配/user权限操作基本完成了,下面我们可以访问/user/index看看吧,正常就没事,如果没有仍然提示没权限,那估计就是你的事了,重头再来多操作几遍吧骚年。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

It allows users to perform more in-depth operations and customization of the system. Root permission is an administrator permission in the Android system. Obtaining root privileges usually requires a series of tedious steps, which may not be very friendly to ordinary users, however. By enabling root permissions with one click, this article will introduce a simple and effective method to help users easily obtain system permissions. Understand the importance and risks of root permissions and have greater freedom. Root permissions allow users to fully control the mobile phone system. Strengthen security controls, customize themes, and users can delete pre-installed applications. For example, accidentally deleting system files causing system crashes, excessive use of root privileges, and inadvertent installation of malware are also risky, however. Before using root privileges

Certain folders are not always accessible due to permissions, and in today’s guide we will show you how to access user folders on your old hard drive on Windows 11. The process is simple but can take a while, sometimes even hours, depending on the size of the drive, so be extra patient and follow the instructions in this guide closely. Why can't I access my user folders on my old hard drive? User folders are owned by another computer, so you cannot modify them. You don't have any permissions on the folder other than ownership. How to open user files on old hard drive? 1. Take ownership of the folder and change permissions Find the old user directory, right-click on it and select Properties. Navigate to "An

Deleting a file in Linux requires all permissions of the folder where it is located, namely read, write, and execute. Because the process of locating this file requires entering the folder, even if you use a method similar to rm /xxx/fle, the folder will also be entered within the system, so you must have execution permissions on the folder, and then read permissions are required to read the folder contents. , and finally delete the file. Since the file is part of the superior folder, it requires write permission on the folder.

In iOS17, Apple has more control over what apps can see in photos. Read on to learn how to manage app access by app. In iOS, Apple's in-app photo picker lets you share specific photos with the app, while the rest of your photo library remains private. Apps must request access to your entire photo library, and you can choose to grant the following access to apps: Restricted Access – Apps can only see images that you can select, which you can do at any time in the app or by going to Settings > ;Privacy & Security>Photos to view selected images. Full access – App can view photos

How to set permission access in QQ space? You can set permission access in QQ space, but most friends don’t know how to set permission access in QQ space. Next is the diagram of how to set permission access in QQ space brought by the editor for users. Text tutorial, interested users come and take a look! QQ usage tutorial QQ space how to set permission access 1. First open the QQ application, click [Avatar] in the upper left corner of the main page; 2. Then expand the personal information area on the left and click the [Settings] function in the lower left corner; 3. Enter the settings page Swipe to find the [Privacy] option; 4. Next in the privacy interface, select the [Permission Settings] service; 5. Then challenge to the latest page and select [Space Dynamics]; 6. Set up in QQ Space again

PHP is a widely used programming language that is widely used to create and develop various web applications. In many web applications, the role permission management system is an important feature to ensure that different users have appropriate access rights. This article will introduce how to use PHP to implement a simple and practical role permission management system. The basic concept of the role permission management system is to divide users into different roles and assign corresponding permissions to each role. In this way, users can only perform operations they have permission to perform, thus ensuring the system's

Permissions and access control strategies that you need to pay attention to before building a web server on CentOS. In the process of building a web server, permissions and access control strategies are very important. Correctly setting permissions and access control policies can protect the security of the server and prevent unauthorized users from accessing sensitive data or improperly operating the server. This article will introduce the permissions and access control strategies that need to be paid attention to when building a web server under the CentOS system, and provide corresponding code examples. User and group management First, we need to create a dedicated

Discuz forum permission management: Read the permission setting guide In Discuz forum management, permission setting is a crucial part. Among them, the setting of reading permissions is particularly important, as it determines the scope of content that different users can see in the forum. This article will introduce in detail the reading permission settings of the Discuz forum and how to flexibly configure it for different needs. 1. Basic concepts of reading permissions In the Discuz forum, reading permissions mainly include the following concepts that need to be understood: Default reading permissions: Default after new user registration
