[DataObjectMethod(DataObjectMethodType.Select, false)]
public List<RoleData> GetRoles(string userName, bool showOnlyAssignedRolls)
{
List<RoleData> roleList = new List<RoleData>(); string[] roleListStr = Roles.GetAllRoles();
foreach (string roleName in roleListStr)
{
bool userInRole = false;
if (userName != null)
{
userInRole = Roles.IsUserInRole(userName, roleName);
} if (showOnlyAssignedRolls == false || userInRole == true)
{
// Getting usersInRole is only used for the count below
string[] usersInRole = Roles.GetUsersInRole(roleName);
RoleData rd = new RoleData();
rd.RoleName = roleName;
rd.UserName = userName;
rd.UserInRole = userInRole;
rd.NumberOfUsersInRole = usersInRole.Length;
roleList.Add(rd);
}
}
return roleList;
}根据我的了解,这个方法是根据参数列出相对应的用户权限,但是,方法里面的bool showOnlyAssignedRolls表示什么意思,帮忙解释下,谢谢
详细解释下这个方法
解决方案 »
- 有没有比较好的.NET页面打印技术?高手请推荐一个解决方案吧!
- webApplication 自动启动
- Timeout expired. The timeout period elapsed prior to obtaining a connection
- net_lover(【孟子E章】) : 我用了你的gridview 固定表头的代码,每列列宽是相同的,不能按内容自动调整。
- c#数据转换的一点疑问?
- 求助:有没有知道Authorware4.0的下载地址的呢?在线等
- 问大家一个问题,什么叫SQL注入式攻击???
- 关于DataGrid不刷新绑定的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 哪位好人,有<<asp.net办公自动化系统开发实例导航>>的源码,寄小弟一份,不胜感激([email protected])!
- ASP.NET加载图文问题
- 网站运行
- 随机打乱数组最简洁高效的方法!
当showOnlyAssignedRolls==false时, select rolename from role
showOnlyAssignedRolls 为false时返回userName所拥有的所有权限的列表集合,列表中每一个元素如下形式:
RoleName :权限名
UserName :就是这个UserName
UserInRole :true
NumberOfUsersInRole :有这个权限的用户个数