public void ClearData() { userData = new UserData(); userDataPackage = new UserDataPackage(); userDataStroage = new UserDataStroage(); userDataRole = new UserDataRole(); userDataItemList = new UserDataItemList(); SaveData(userData); SaveData(userDataPackage); SaveData(userDataStroage); SaveData(userDataRole); SaveData(userDataItemList); }
// 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()); }
public void SaveSecuritySetting() { String appRoles = ctx.Post("appRole"); UserDataRole.DeleteAll(); if (strUtil.HasText(appRoles)) { string[] values = appRoles.Split(','); foreach (String str in values) { if (strUtil.IsNullOrEmpty(str)) { continue; } string[] arrItem = str.Split('_'); if (arrItem.Length != 2) { continue; } int appId = cvt.ToInt(arrItem[0]); int roleId = cvt.ToInt(arrItem[1]); if (appId <= 0 || roleId <= 0) { continue; } UserDataRole ar = new UserDataRole(); ar.AppInfoId = appId; ar.RoleId = roleId; ar.insert(); } } log(SiteLogString.UpdateUserDataPermission(), typeof(UserDataRole)); echoRedirect(lang("saved")); }