public List <int> GetChannelIdList(int siteId, string adminName) { var channelIdList = new List <int>(); if (string.IsNullOrEmpty(adminName)) { return(channelIdList); } if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminName))//如果是超级管理员或站点管理员 { channelIdList = DataProvider.ChannelDao.GetIdListBySiteId(siteId); } else { var ps = new ProductAdministratorWithPermissions(adminName); ICollection channelIdCollection = ps.ChannelPermissionDict.Keys; foreach (int channelId in channelIdCollection) { var allChannelIdList = DataProvider.ChannelDao.GetIdListForDescendant(channelId); allChannelIdList.Insert(0, channelId); foreach (var ownChannelId in allChannelIdList) { var nodeInfo = ChannelManager.GetChannelInfo(siteId, ownChannelId); if (nodeInfo != null) { channelIdList.Add(nodeInfo.Id); } } } } return(channelIdList); }
public static List <PublishmentSystemInfo> GetWritingPublishmentSystemInfoList(string adminUserName) { var publishmentSystemInfoList = new List <PublishmentSystemInfo>(); if (!string.IsNullOrEmpty(adminUserName)) { var publishmentSystemIdList = new List <int>(); if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminUserName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminUserName))//如果是超级管理员或站点管理员 { var ps = new ProductAdministratorWithPermissions(adminUserName); foreach (var itemForPsid in ps.WebsitePermissionDict.Keys) { if (!publishmentSystemIdList.Contains(itemForPsid)) { var publishmentSystemInfo = GetPublishmentSystemInfo(itemForPsid); if ((Equals(EPublishmentSystemType.CMS, publishmentSystemInfo.PublishmentSystemType) || Equals(EPublishmentSystemType.WCM, publishmentSystemInfo.PublishmentSystemType))) { publishmentSystemInfoList.Add(publishmentSystemInfo); publishmentSystemIdList.Add(itemForPsid); } } } } else { var roles = BaiRongDataProvider.RoleDao.GetRolesForUser(adminUserName); var ps = new ProductAdministratorWithPermissions(adminUserName); foreach (var itemForPsid in ps.WebsitePermissionDict.Keys) { if (!publishmentSystemIdList.Contains(itemForPsid)) { var nodeIdCollection = DataProvider.SystemPermissionsDao.GetAllPermissionList(roles, itemForPsid, true); var publishmentSystemInfo = GetPublishmentSystemInfo(itemForPsid); if (nodeIdCollection.Count > 0) { publishmentSystemInfoList.Add(publishmentSystemInfo); publishmentSystemIdList.Add(itemForPsid); } } } } } return(publishmentSystemInfoList); }
public static List <ISiteInfo> GetWritingSiteInfoList(string adminUserName) { var siteInfoList = new List <ISiteInfo>(); if (!string.IsNullOrEmpty(adminUserName)) { var siteIdList = new List <int>(); if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminUserName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminUserName))//如果是超级管理员或站点管理员 { var ps = new ProductAdministratorWithPermissions(adminUserName); foreach (var itemForPsid in ps.WebsitePermissionDict.Keys) { if (!siteIdList.Contains(itemForPsid)) { var siteInfo = GetSiteInfo(itemForPsid); siteInfoList.Add(siteInfo); siteIdList.Add(itemForPsid); } } } else { var roles = DataProvider.AdministratorsInRolesDao.GetRolesForUser(adminUserName); var ps = new ProductAdministratorWithPermissions(adminUserName); foreach (var itemForPsid in ps.WebsitePermissionDict.Keys) { if (!siteIdList.Contains(itemForPsid)) { var channelIdCollection = DataProvider.SitePermissionsDao.GetAllPermissionList(roles, itemForPsid, true); var siteInfo = GetSiteInfo(itemForPsid); if (channelIdCollection.Count > 0) { siteInfoList.Add(siteInfo); siteIdList.Add(itemForPsid); } } } } } return(siteInfoList); }
public static List <NodeInfo> GetWritingNodeInfoList(string adminUserName, int publishmentSystemId) { var nodeInfoList = new List <NodeInfo>(); if (!string.IsNullOrEmpty(adminUserName)) { if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminUserName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminUserName))//如果是超级管理员或站点管理员 { var nodeList = DataProvider.NodeDao.GetNodeInfoListByPublishmentSystemId(publishmentSystemId, string.Empty); foreach (var nodeInfo in nodeList) { if (nodeInfo != null && EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.Content)) { nodeInfoList.Add(nodeInfo); } } } else { var ps = new ProductAdministratorWithPermissions(adminUserName); ICollection nodeIdCollection = ps.ChannelPermissionDict.Keys; foreach (int nodeId in nodeIdCollection) { var nodeIdList = DataProvider.NodeDao.GetNodeIdListForDescendant(nodeId); nodeIdList.Insert(0, nodeId); foreach (int ownNodeId in nodeIdList) { var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemId, ownNodeId); if (nodeInfo != null && EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.Content)) { nodeInfoList.Add(nodeInfo); } } } } } return(nodeInfoList); }
public void Page_Load(object sender, EventArgs e) { var mechanismDao = new MechanismDao(); if (IsForbidden) { return; } if (!HasWebsitePermissions(AppManager.Cms.Permission.WebSite.SiteEdit)) { FailMessage("无站点修改权限"); return; } if (!IsPostBack) { var currentPublishmentSystemId = Body.GetQueryInt("PublishmentSystemId"); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(currentPublishmentSystemId); PublishmentSystemArea.Text = publishmentSystemInfo.Area; PublishmentSystemName.Text = publishmentSystemInfo.PublishmentSystemName; //PublishmentSystemType.Items.Add(new ListItem(mechanismDao.GetMechanismTypeTextById(PublishmentSystemInfo.OrganizationTypeId), PublishmentSystemInfo.OrganizationTypeId.ToString())); //PublishmentSystemCategory.Items.Add(new ListItem((mechanismDao.GetMechanismCategoryTextById(PublishmentSystemInfo.OrganizationCategory)), PublishmentSystemInfo.OrganizationCategory.ToString())); TelePhone.Text = publishmentSystemInfo.TelePhone; Address.Text = publishmentSystemInfo.Address; BasicFacts.Text = publishmentSystemInfo.BasicFacts; ImageUrl.Text = publishmentSystemInfo.ImageUrl; Characteristic.Text = publishmentSystemInfo.Characteristic; var administratorInfo = BaiRongDataProvider.AdministratorDao.GetByAccount(publishmentSystemInfo.AdministratorAccount); AdministratorAccount.Text = administratorInfo.UserName; AdministratorAccount.Enabled = false; //AdministratorPassWord.Text = administratorInfo.Password; var typeDic = DataProvider.MechanismDao.GetMechanismTypeAll(); var categoryDic = DataProvider.MechanismDao.GetMechanismCategoryAll(); foreach (var type in typeDic) { var listItem = new ListItem(type.Value, type.Key.ToString()); if (type.Key == publishmentSystemInfo.OrganizationTypeId) { listItem.Selected = true; } CblPublishmentSystemType.Items.Add(listItem); } foreach (var category in categoryDic) { var listItem = new ListItem(category.Value, category.Key.ToString()); if (category.Key == publishmentSystemInfo.OrganizationCategory) { listItem.Selected = true; } CblPublishmentSystemCategory.Items.Add(listItem); } DataTable dt = new DataTable(); if (PermissionsManager.GetPermissions(publishmentSystemInfo.AdministratorAccount).IsAdministrator) { dt = DataProvider.SystemPermissionsDao.GetAllList(); } else { dt = DataProvider.SystemPermissionsDao.GetList(PermissionsManager.GetPermissions(publishmentSystemInfo.AdministratorAccount).Roles); } var permissions = new ProductAdministratorWithPermissions(PublishmentSystemInfo.AdministratorAccount); var channelPermision = permissions.ChannelPermissionDict; var webSitePermission = permissions.WebsitePermissionDict; rptContents.DataSource = dt; rptContents.DataBind(); for (int i = 0; i < rptContents.Items.Count; i++) { string nodeId = ((HiddenField)rptContents.Items[i].FindControl("hidNodeId")).Value; string navName = ((HiddenField)rptContents.Items[i].FindControl("hidName")).Value; CheckBoxList cblActionType = (CheckBoxList)rptContents.Items[i].FindControl("cblActionType"); foreach (KeyValuePair <int, List <string> > kv in channelPermision) { if (kv.Key.ToString().Equals(nodeId, StringComparison.OrdinalIgnoreCase)) { for (int n = 0; n < cblActionType.Items.Count; n++) { if (kv.Value.Contains(cblActionType.Items[n].Value)) { cblActionType.Items[n].Selected = true; } } } } } //rptContents.ItemDataBound += rptContents_ItemDataBound; List <PermissionConfig> webSitePermissions = new List <PermissionConfig>(); //var currentWebsitePermissions= foreach (PermissionConfig permission in PermissionConfigManager.Instance.WebsitePermissions) { //if (permission.Name == websitePermission) //{ // WebsitePermissionsPlaceHolder.Visible = true; // var listItem = new ListItem(permission.Text, permission.Name); // WebsitePermissions.Items.Add(listItem); //} if (StringUtils.EqualsIgnoreCase(permission.Type, "party")) { webSitePermissions.Add(permission); } } rptWebSite.DataSource = webSitePermissions; rptWebSite.DataBind(); for (int i = 0; i < rptWebSite.Items.Count; i++) { CheckBoxList cblActionType = (CheckBoxList)rptWebSite.Items[i].FindControl("cblWebSiteType"); for (int n = 0; n < cblActionType.Items.Count; n++) { foreach (List <string> list in webSitePermission.Values) { if (list.Contains(cblActionType.Items[n].Value)) { cblActionType.Items[n].Selected = true; } } } } } }