// 3) 用户管理数据检查 private Boolean checkUserDataAdminPermission() { if (isUserDataAdmin() == false) { return(true); } String ns = ctx.route.ns; string[] arrItem = strUtil.TrimStart(ns, "Admin.Apps.").Split('.'); String app = arrItem[0]; Boolean hasPermission = UserDataRole.IsRoleInApp(((User)ctx.viewer.obj).RoleId, app); if (!hasPermission) { echo(lang("exNoUserDataAdminPermission")); return(false); } return(true); }
private void bindUaRoleList(List <SiteRole> roles, List <AppInstaller> apps) { IBlock roleBlock = getBlock("roles"); foreach (SiteRole role in roles) { roleBlock.Set("role.Name", role.Name); IBlock appBlock = roleBlock.GetBlock("apps"); foreach (AppInstaller app in apps) { String strChecked = UserDataRole.IsRoleInApp(role.Id, app.Id) ? "checked=\"checked\"" : ""; appBlock.Set("checkedString", strChecked); appBlock.Set("app.Id", app.Id); appBlock.Set("role.Id", role.Id); appBlock.Next(); } roleBlock.Next(); } }
private String getUserDataAppList(List <AppInstaller> apps) { StringBuilder builder = new StringBuilder(); builder.Append("<li id=\"userDataAdminItem\"><div>{0}</div><div><span id=\"userDataAdmin\" list=\"userDataAdminMenus\" class=\"menuMore left10 right10\">{1} " + getDownImg() + ""); builder.Append("<ul id=\"userDataAdminMenus\" class=\"menuItems\" style=\"display: none; width:100px;\">"); foreach (AppInstaller app in apps) { if (!UserDataRole.IsRoleInApp(((User)ctx.viewer.obj).RoleId, app.Id)) { continue; } builder.Append("<li>"); builder.Append(getUserDataAdminLink(app)); builder.Append("</li>"); } builder.Append("</ul></span></div></li>"); return(builder.ToString()); }