亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rolecontroller.cs

?? SharpNuke源代碼
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Collections;
using System.Data;
using System.Text;

using DotNetNuke.Common.Utilities;
using DotNetNuke.Data;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Services.Exceptions;

//
// DotNetNuke -  http://www.dotnetnuke.com
// Copyright (c) 2002-2005
// by Shaun Walker ( sales@perpetualmotion.ca ) of Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

namespace DotNetNuke.Security.Roles
{
	
	/// -----------------------------------------------------------------------------
	/// Project:    DotNetNuke
	/// Namespace:  DotNetNuke.Security.Roles
	/// Class:      RoleController
	/// -----------------------------------------------------------------------------
	/// <summary>
	/// The RoleController class provides Business Layer methods for Roles
	/// </summary>
	/// <history>
	///     [cnurse]    05/23/2005  made compatible with .NET 2.0
	/// </history>
	/// -----------------------------------------------------------------------------
	public class RoleController
	{
		
		#region "Private Methods"
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Auto Assign existing users to a role
		/// </summary>
		/// <param name="roleInfo">The Role to Auto assign</param>
		/// <param name="RoleId">The Id of the Role</param>
		/// <param name="SynchronizationMode">not used</param>
		/// <history>
		/// 	[cnurse]	05/23/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		private void AutoAssignUsers (RoleInfo roleInfo, int roleId, bool synchronizationMode)
		{
			
			if (roleInfo.AutoAssignment)
			{
				// loop through users for portal and add to role
				IDataReader dr = DataProvider.Instance().GetUsers(roleInfo.PortalID);
				while (dr.Read())
				{
					try
					{
						AddUserRole(roleInfo.PortalID, Convert.ToInt32(dr["UserId"]), roleId, Null.NullDate);
					}
					catch (Exception)
					{
						// user already belongs to role
					}
				}
				dr.Close();
			}
		}
		
		#endregion
		
		#region "Public Methods"
		
		/// <summary>
		/// Add a new role
		/// </summary>
		/// <param name="roleInfo">The Role to Add</param>
		/// <returns>The Id of the new role</returns>
		/// <returns></returns>
		/// <history>
		/// 	[cnurse]	05/23/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public int AddRole(RoleInfo roleInfo)
		{
			return AddRole(roleInfo, false);
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// This overload adds a role and optionally adds the info to the AspNet Roles
		/// </summary>
		/// <param name="roleInfo">The Role to Add</param>
		/// <param name="SynchronizationMode">Flag indicating whether the role should be
		/// added to the AspNet Roles</param>
		/// <returns>The Id of the new role</returns>
		/// <history>
		/// 	[cnurse]	05/23/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public int AddRole(RoleInfo roleInfo, bool synchronizationMode)
		{
			
			string originalAppName = Common.Globals.GetApplicationName();
			try
			{
				if (! synchronizationMode)
				{
					Common.Globals.SetApplicationName(roleInfo.PortalID);
					Microsoft.ScalableHosting.Security.Roles.CreateRole(roleInfo.RoleName);
				}
				
				int roleId = - 1;
				roleId = DataProvider.Instance().AddRole(roleInfo.PortalID, roleInfo.RoleName, roleInfo.Description, 
					roleInfo.ServiceFee, roleInfo.BillingPeriod.ToString(), roleInfo.BillingFrequency, 
					roleInfo.TrialFee, roleInfo.TrialPeriod, roleInfo.TrialFrequency, roleInfo.IsPublic, 
					roleInfo.AutoAssignment);
				
				AutoAssignUsers(roleInfo, roleId, synchronizationMode);
				
				return roleId;
			}
			finally
			{
				//Reset the Application Name
				Common.Globals.SetApplicationName(originalAppName);
			}
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Adds a User to a Role
		/// </summary>
		/// <param name="PortalID">The Id of the Portal</param>
		/// <param name="UserId">The Id of the User</param>
		/// <param name="RoleId">The Id of the Role</param>
		/// <param name="ExpiryDate">The expiry Date of the Role membership</param>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public void AddUserRole (int portalID, int userId, int roleId, DateTime expiryDate)
		{
			
			string originalAppName = string.Empty;
			
			UserController userController = new UserController();
			UserInfo userInfo = userController.GetUser(portalID, userId);
			UserRoleInfo userRoleInfo = GetUserRole(portalID, userId, roleId);
			
			if (userRoleInfo == null)
			{
				originalAppName = Common.Globals.GetApplicationName();
				Common.Globals.SetApplicationName(portalID);
				DataProvider.Instance().AddUserRole(portalID, userId, roleId, expiryDate);
				userRoleInfo = GetUserRole(portalID, userId, roleId);
				try
				{
					Microsoft.ScalableHosting.Security.Roles.AddUserToRole(userInfo.Membership.Username, userRoleInfo.RoleName);
				}
				catch (Exception)
				{
					//Reset the Application Name
					Common.Globals.SetApplicationName(originalAppName);
				}
			}
			else
			{
				DataProvider.Instance().UpdateUserRole(userRoleInfo.UserRoleID, expiryDate);
			}
			
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Delete a Role
		/// </summary>
		/// <param name="RoleId">The Id of the Role to delete</param>
		/// <param name="PortalId">The Id of the Portal</param>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public void DeleteRole (int roleId, int portalId)
		{
			string originalAppName = Common.Globals.GetApplicationName();
			try
			{
				RoleInfo roleInfo = GetRole(roleId, portalId);
				
				Common.Globals.SetApplicationName(portalId);
				
				//Remove all users from Role
				string[] users = Microsoft.ScalableHosting.Security.Roles.GetUsersInRole(roleInfo.RoleName);
				if (users.Length > 0)
				{
					Microsoft.ScalableHosting.Security.Roles.RemoveUsersFromRole(users, roleInfo.RoleName);
				}
				
				//Remove role
				Microsoft.ScalableHosting.Security.Roles.DeleteRole(roleInfo.RoleName);
				
				DataProvider.Instance().DeleteRole(roleId);
			}
			finally
			{
				//Reset the Application Name
				Common.Globals.SetApplicationName(originalAppName);
			}
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Delete/Remove a User from a Role
		/// </summary>
		/// <param name="PortalID">The Id of the Portal</param>
		/// <param name="UserId">The Id of the User</param>
		/// <param name="RoleId">The Id of the Role</param>
		/// <returns></returns>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public bool DeleteUserRole(int portalId, int userId, int roleId)
		{
			string originalAppName = Common.Globals.GetApplicationName();
			try
			{
				UserController userController = new UserController();
				UserInfo userInfo = userController.GetUser(portalId, userId);
				UserRoleInfo userRoleInfo = GetUserRole(portalId, userId, roleId);
				
				PortalController portalController = new PortalController();
				bool delete = true;
				
				PortalInfo portalInfo = portalController.GetPortal(portalId);
				if (portalInfo != null)
				{
					if ((portalInfo.AdministratorId != userId || portalInfo.AdministratorRoleId != roleId) && portalInfo.RegisteredRoleId != roleId)
					{
						Common.Globals.SetApplicationName(portalId);
						Microsoft.ScalableHosting.Security.Roles.RemoveUserFromRole(userInfo.Membership.Username, userRoleInfo.RoleName);
						DataProvider.Instance().DeleteUserRole(userId, roleId);
					}
					else
					{
						delete = false;
					}
				}
				return delete;
			}
			finally
			{
				//Reset the Application Name
				Common.Globals.SetApplicationName(originalAppName);
			}
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Get a list of roles for the Portal
		/// </summary>
		/// <param name="PortalId">The Id of the Portal</param>
		/// <returns>An ArrayList of RoleInfo objects</returns>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public ArrayList GetPortalRoles(int portalId)
		{
			return GetPortalRoles(portalId, false);
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// This overloads get a list of roles and optionally synchronizes the DNN and
		/// AspNet Roles
		/// </summary>
		/// <param name="PortalId">The Id of the Portal</param>
		/// <param name="SynchronizeRoles">Flagg that indicates whether the DNN and
		/// AspNet roles should be Synchronized</param>
		/// <returns>An ArrayList of RoleInfo objects</returns>
		/// <returns>An ArrayList of RoleInfo objects</returns>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public ArrayList GetPortalRoles(int portalId, bool synchronizeRoles)
		{
			if (synchronizeRoles)
			{
				this.SynchronizeRoles(portalId);
			}
			return CBO.FillCollection(DataProvider.Instance().GetPortalRoles(portalId), typeof(RoleInfo));
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Gets a list of Roles for a User
		/// </summary>
		/// <param name="UserId">The Id of the User</param>
		/// <param name="PortalID">The Id of the Portal</param>
		/// <returns>A string that contains a list of Roles fro the User delimited by "|"</returns>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public string[] GetPortalRolesByUser(int userId, int portalId)
		{
			ArrayList roles = new ArrayList();
			IDataReader dr = null;
			try
			{
				dr = DataProvider.Instance().GetRolesByUser(userId, portalId);
				while (dr.Read())
				{
					roles.Add(System.Convert.ToString(dr["RoleName"]));
				}
				if (roles.Count > 0)
				{
					return (string[])roles.ToArray(typeof(string));
				}
				return null;
			}
			finally
			{
				if (dr != null)
				{
					dr.Close();
				}
			}
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Fetch a single Role
		/// </summary>
		/// <param name="RoleID">The Id of the Role</param>
		/// <param name="PortalID">The Id of the Portal</param>
		/// <returns></returns>
		/// <remarks></remarks>
		/// <history>
		/// 	[cnurse]	05/24/2005	Documented
		/// </history>
		/// -----------------------------------------------------------------------------
		public RoleInfo GetRole(int roleID, int portalID)
		{
			return ((RoleInfo) CBO.FillObject(DataProvider.Instance().GetRole(roleID, portalID), typeof(RoleInfo)));
		}
		
		/// -----------------------------------------------------------------------------
		/// <summary>
		/// Obtains a role given the role name
		/// </summary>
		/// <param name="PortalId">Portal indentifier</param>
		/// <param name="RoleName">Name of the role to be found</param>
		/// <returns>A RoleInfo object is the role is found</returns>
		/// <history>
		/// 	[VMasanas]	27/08/2004	Created
		/// </history>
		/// -----------------------------------------------------------------------------
		public RoleInfo GetRoleByName(int portalId, string roleName)
		{
			return GetRoleByName(portalId, roleName, false);
		}
		

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费看片在线观看| 久久伊人蜜桃av一区二区| 91精品国产综合久久福利| 久久久久久久精| 亚洲图片有声小说| 99热99精品| 亚洲国产精品ⅴa在线观看| 麻豆精品久久久| 欧美日韩视频在线一区二区| 国产精品二区一区二区aⅴ污介绍| 日韩制服丝袜先锋影音| 91色.com| 亚洲欧洲99久久| 国产成人综合亚洲网站| 精品久久久久一区| 日韩激情中文字幕| 51精品视频一区二区三区| 一区二区在线看| 不卡区在线中文字幕| 久久久精品国产免费观看同学| 天天色 色综合| 欧美日韩一区二区在线观看视频| 最新成人av在线| 成人aaaa免费全部观看| 国产日韩一级二级三级| 韩国一区二区在线观看| 精品国产乱码久久久久久免费 | 69p69国产精品| 亚洲一区二区三区四区中文字幕| 99久久777色| 亚洲日韩欧美一区二区在线| av欧美精品.com| 国产精品欧美经典| 91在线视频18| 亚洲综合视频网| 欧美日韩精品一区二区| 亚洲成人av在线电影| 欧美精品vⅰdeose4hd| 亚洲高清不卡在线| 欧美理论片在线| 免费日本视频一区| 欧美va亚洲va在线观看蝴蝶网| 午夜精品成人在线视频| 日韩欧美在线一区二区三区| 国产在线视频不卡二| 国产日韩三级在线| 99综合影院在线| 亚洲激情一二三区| 制服丝袜激情欧洲亚洲| 国产一区激情在线| 中文字幕欧美区| 色婷婷综合久久久中文一区二区| 一区二区三区日韩欧美| 欧美视频一区二区三区| 麻豆91免费看| 欧美国产日产图区| 日本乱人伦一区| 日本va欧美va精品| 久久精品视频免费| 色狠狠桃花综合| 狠狠久久亚洲欧美| 亚洲日本丝袜连裤袜办公室| 在线综合视频播放| 国产白丝网站精品污在线入口| 一区二区在线看| 精品美女在线观看| 色94色欧美sute亚洲13| 久久黄色级2电影| 中文字幕日韩精品一区| 91精品国产手机| 成人av资源在线观看| 视频一区二区三区入口| 亚洲国产精品成人综合色在线婷婷 | 日韩vs国产vs欧美| 亚洲国产精品t66y| 91精品在线免费| 99视频热这里只有精品免费| 蜜桃视频在线观看一区二区| 国产精品欧美一区喷水| 91精品国产乱| 91丨九色丨黑人外教| 久久91精品国产91久久小草| 一级女性全黄久久生活片免费| 久久丝袜美腿综合| 欧美色倩网站大全免费| 国产成人av一区二区| 日韩和欧美一区二区| 亚洲色图第一区| 久久久美女毛片| 欧美一级理论性理论a| 欧美在线啊v一区| 成人综合婷婷国产精品久久免费| 日韩国产在线观看一区| 亚洲黄色片在线观看| 国产欧美1区2区3区| www亚洲一区| 91精品国产入口| 欧美午夜一区二区| 色婷婷久久久综合中文字幕 | 亚洲人成伊人成综合网小说| 久久影院午夜片一区| 91精品国产综合久久精品| 色成人在线视频| 91麻豆精品秘密| www.av精品| 国产成人在线视频网站| 麻豆国产精品官网| 免费在线看成人av| 国产成人在线网站| 国内国产精品久久| 国内精品国产成人国产三级粉色| 蜜乳av一区二区| 免费一级欧美片在线观看| 婷婷中文字幕综合| 日本不卡一二三区黄网| 日韩精品欧美成人高清一区二区| 亚洲国产中文字幕| 午夜私人影院久久久久| 午夜精品久久久久久久久久久| 风间由美一区二区三区在线观看| 国产成人av电影在线| 国产成人精品影视| 成人久久18免费网站麻豆| 成人午夜看片网址| 91浏览器打开| 91国内精品野花午夜精品| 欧美综合一区二区| 日韩一级片在线观看| 久久亚洲私人国产精品va媚药| 国产三级一区二区三区| 国产精品欧美一级免费| 一区二区三区欧美久久| 午夜a成v人精品| 国内不卡的二区三区中文字幕| 国产乱码一区二区三区| 99久久精品免费| 欧美视频一区在线| 日韩精品中文字幕一区| 国产欧美综合在线观看第十页| 中文字幕乱码久久午夜不卡| 亚洲欧洲另类国产综合| 午夜精品久久久久久久蜜桃app| 激情五月激情综合网| 99久久精品费精品国产一区二区| 欧美日韩午夜影院| 国产性天天综合网| 亚洲一线二线三线视频| 捆绑变态av一区二区三区| 成人免费福利片| 91丨九色丨蝌蚪丨老版| 欧美区视频在线观看| 久久久五月婷婷| 亚洲欧洲综合另类在线| 日本伊人午夜精品| 粉嫩绯色av一区二区在线观看| 欧美性色黄大片| 国产午夜精品一区二区三区四区 | 粉嫩一区二区三区在线看| 日本韩国欧美在线| 久久久久久久综合狠狠综合| 亚洲伦理在线免费看| 久久精品国产第一区二区三区| 成人中文字幕电影| 欧美一级在线观看| 亚洲卡通欧美制服中文| 国产在线一区二区综合免费视频| 日本韩国欧美一区二区三区| 久久久久久久久免费| 午夜视频一区在线观看| jlzzjlzz亚洲女人18| 精品盗摄一区二区三区| 日韩高清不卡一区二区三区| 成人黄色在线看| 欧美丰满高潮xxxx喷水动漫| 精品国产一区久久| 亚洲va欧美va国产va天堂影院| 成人伦理片在线| 欧美www视频| 日韩精品国产欧美| 欧洲中文字幕精品| 亚洲女子a中天字幕| 成人免费三级在线| 亚洲综合自拍偷拍| 91丨九色丨国产丨porny| 欧美—级在线免费片| 国产九九视频一区二区三区| 91精品国产综合久久久久久久| 亚洲综合无码一区二区| av中文字幕不卡| 欧美韩国日本一区| 国产成人午夜电影网| 久久久美女艺术照精彩视频福利播放| 免费观看久久久4p| 91精品国产一区二区三区香蕉| 午夜国产不卡在线观看视频| 欧美日韩精品一区二区三区蜜桃 | 国产一区二区看久久| 精品福利视频一区二区三区| 欧美日韩高清一区二区不卡| 亚洲激情网站免费观看|