当前位置: 首页>>代码示例>>C#>>正文


C# WebServiceResponse.IsInRole方法代码示例

本文整理汇总了C#中MonkeyWrench.DataClasses.Logic.WebServiceResponse.IsInRole方法的典型用法代码示例。如果您正苦于以下问题:C# WebServiceResponse.IsInRole方法的具体用法?C# WebServiceResponse.IsInRole怎么用?C# WebServiceResponse.IsInRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonkeyWrench.DataClasses.Logic.WebServiceResponse的用法示例。


在下文中一共展示了WebServiceResponse.IsInRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VerifyUserInRole

		public static void VerifyUserInRole (HttpContext Context, DB db, WebServiceLogin login, string role, bool @readonly)
		{
			WebServiceResponse dummy = new WebServiceResponse ();
			Authenticate (Context, db, login, dummy, @readonly);

			if (!dummy.IsInRole (role)) {
				log.InfoFormat ("The user '{0}' has the roles '{1}', and requested role is: {2}", login.User, dummy.UserRoles == null ? "<null>" : string.Join (",", dummy.UserRoles), role);
				throw new UnauthorizedException ("You don't have the required permissions.");
			}
		}
开发者ID:joewstroman,项目名称:monkeywrench,代码行数:10,代码来源:Authentication.cs

示例2: VerifyUserInRole

		public static void VerifyUserInRole (string remote_ip, DB db, WebServiceLogin login, string role, bool @readonly)
		{
			WebServiceResponse dummy = new WebServiceResponse ();
			Authenticate (remote_ip, db, login, dummy, @readonly);

			if (!dummy.IsInRole (role)) {
				Logger.Log (2, "The user '{0}' has the roles '{1}', and requested role is: {2}", login.User, dummy.UserRoles == null ? "<null>" : string.Join (",", dummy.UserRoles), role);
				throw new HttpException (403, "You don't have the required permissions.");
			}
		}
开发者ID:hackmp,项目名称:monkeywrench,代码行数:10,代码来源:Authentication.cs

示例3: VerifyUserInRoles

		public static void VerifyUserInRoles (HttpContext Context, DB db, WebServiceLogin login, string[] roles, bool @readonly)
		{
			WebServiceResponse dummy = new WebServiceResponse ();
			Authenticate (Context, db, login, dummy, @readonly);

			foreach (var role in roles) {
				if (string.IsNullOrEmpty(role))
					continue;
				if (dummy.IsInRole(role))
					return;
			}

			var userRoles = dummy.UserRoles == null ? "<null>" : string.Join(",", dummy.UserRoles);
			var requestedRoles = roles == null ? "<null>" : string.Join(",", roles);

			log.InfoFormat("The user '{0}' has the roles '{1}', and requested roles are: {2}", login.User, userRoles, requestedRoles);
			throw new UnauthorizedException("You don't have the required permissions.");
		}
开发者ID:MSylvia,项目名称:monkeywrench,代码行数:18,代码来源:Authentication.cs


注:本文中的MonkeyWrench.DataClasses.Logic.WebServiceResponse.IsInRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。