Пример #1
0
 public static string GetValueForCopy(ApplyTo.Copy applyTo)
 {
     switch (applyTo)
     {
         case ApplyTo.Copy.ResourceOnly:
             return "0";
         case ApplyTo.Copy.ResourceAndAncestors:
             return "infinity";
         default:
             throw new InvalidEnumArgumentException("applyTo", (int)applyTo, typeof(ApplyTo.Copy));
     }
 }
Пример #2
0
 public static string GetValueForPropfind(ApplyTo.Propfind applyTo)
 {
     switch (applyTo)
     {
         case ApplyTo.Propfind.ResourceOnly:
             return "0";
         case ApplyTo.Propfind.ResourceAndChildren:
             return "1";
         case ApplyTo.Propfind.ResourceAndAncestors:
             return "infinity";
         default:
             throw new InvalidEnumArgumentException("applyTo", (int)applyTo, typeof(ApplyTo.Propfind));
     }
 }
			public override void Setup(TransitionBase.ParametersBase defaults) {

				var param = defaults as Parameters;
				if (param == null) return;

				// Place params installation here
				this.inState = new State(param.inState);
                this.outState = new State(param.outState);
                this.resetState = new State(param.resetState);

				this.moveRoot = param.moveRoot;

				this.stateApply = param.stateApply;

			}
Пример #4
0
 public WebSudoRequiredAttribute(ApplyTo applyTo)
 {
     this.ApplyTo = applyTo;
     this.Priority = -79;
 }
Пример #5
0
 protected virtual object Run(RoutePriority request, ApplyTo method)
 {
     return(request.AsTypeString());
 }
Пример #6
0
 public AuthenticateAttribute(ApplyTo applyTo, string provider)
     : this(applyTo)
 {
     this.Provider = provider;
 }
Пример #7
0
 public RequiredPermissionAttribute(ApplyTo applyTo, params string[] permissions)
 {
     this.RequiredPermissions = permissions.ToList();
     this.ApplyTo             = applyTo;
     this.Priority            = (int)RequestFilterPriority.RequiredPermission;
 }
Пример #8
0
 public RequestFilterAttribute()
 {
     ApplyTo = ApplyTo.All;
 }
Пример #9
0
 public AuthenticateAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
     this.Priority = (int)RequestFilterPriority.Authenticate;
 }
Пример #10
0
 public ContextualFilterTestAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
 }
Пример #11
0
 public AuthorizationRequiredAttribute(ApplyTo applyTo, params string[] permissions)
     : base(applyTo, permissions)
 {
 }
		public RequiresAuthenticateAttribute(ApplyTo applyTo, string provider)
			: this(applyTo)	{}
		public RequiresAuthenticateAttribute(ApplyTo applyTo)
			: base(applyTo)	{}
Пример #14
0
 protected virtual object Run(RoutePriority request, ApplyTo method)
 {
     return request.AsTypeString();
 }
 public AuthenticateAttribute(ApplyTo applyTo, string provider)
 {
     this.Provider = provider;
     this.ApplyTo = applyTo;
 }
Пример #16
0
 public static IServiceRoutes Add <TRequest>(this IServiceRoutes routes, string restPath, ApplyTo verbs)
 {
     return(routes.Add <TRequest>(restPath, verbs.ToVerbsString()));
 }
Пример #17
0
 public TagAttribute(string name = null, ApplyTo applyTo = ApplyTo.All)
 {
     Name    = name;
     ApplyTo = applyTo;
 }
Пример #18
0
        public static void ConvertToFileSystemFlags(ApplyTo ApplyTo, out InheritanceFlags inheritanceFlags, out PropagationFlags propagationFlags)
        {
            inheritanceFlags = InheritanceFlags.None;
            propagationFlags = PropagationFlags.None;

            switch (ApplyTo)
            {
            case ApplyTo.FilesOnly:
                inheritanceFlags = InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.InheritOnly;
                break;

            case ApplyTo.SubfoldersAndFilesOnly:
                inheritanceFlags = InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit;
                propagationFlags = PropagationFlags.InheritOnly;
                break;

            case ApplyTo.SubfoldersOnly:
                inheritanceFlags = InheritanceFlags.ContainerInherit;
                propagationFlags = PropagationFlags.InheritOnly;
                break;

            case ApplyTo.ThisFolderAndFiles:
                inheritanceFlags = InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.None;
                break;

            case ApplyTo.ThisFolderAndSubfolders:
                inheritanceFlags = InheritanceFlags.ContainerInherit;
                propagationFlags = PropagationFlags.None;
                break;

            case ApplyTo.ThisFolderOnly:
                inheritanceFlags = InheritanceFlags.None;
                propagationFlags = PropagationFlags.None;
                break;

            case ApplyTo.ThisFolderSubfoldersAndFiles:
                inheritanceFlags = InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.None;
                break;

            case ApplyTo.FilesOnlyOneLevel:
                inheritanceFlags = InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.InheritOnly | PropagationFlags.NoPropagateInherit;
                break;

            case ApplyTo.SubfoldersAndFilesOnlyOneLevel:
                inheritanceFlags = InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.InheritOnly | PropagationFlags.NoPropagateInherit;
                break;

            case ApplyTo.SubfoldersOnlyOneLevel:
                inheritanceFlags = InheritanceFlags.ContainerInherit;
                propagationFlags = PropagationFlags.InheritOnly | PropagationFlags.NoPropagateInherit;
                break;

            case ApplyTo.ThisFolderAndFilesOneLevel:
                inheritanceFlags = InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.NoPropagateInherit;
                break;

            case ApplyTo.ThisFolderAndSubfoldersOneLevel:
                inheritanceFlags = InheritanceFlags.ContainerInherit;
                propagationFlags = PropagationFlags.NoPropagateInherit;
                break;

            case ApplyTo.ThisFolderSubfoldersAndFilesOneLevel:
                inheritanceFlags = InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit;
                propagationFlags = PropagationFlags.NoPropagateInherit;
                break;
            }
        }
 public ResponseFilterAttribute()
 {
     ApplyTo = ApplyTo.All;
 }
Пример #20
0
 public RequireJwtAttribute(ApplyTo applyTo = ApplyTo.All)
     : base(applyTo)
 {
     this.Priority = (int)RequestFilterPriority.Authenticate;
 }
		public PermissionAttribute(ApplyTo applyTo, params string[] permissions):base(applyTo, permissions)
		{
		}
Пример #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpHeaderAttribute"/>
 /// class that applies to the HTTP  methods defined by the flag
 /// <paramref name="apply_to"/> and uses the default authentication
 /// challenge.
 /// </summary>
 /// <param name="apply_to">
 /// A flag that indicates for which method this attribute should be applied.
 /// </param>
 public HttpHeaderAttribute(ApplyTo apply_to) : base(apply_to)
 {
     Value = string.Empty;
 }
 /// <summary>Initializes a new instance of the NServiceKit.ServiceInterface.RequiredRoleAttribute class.</summary>
 ///
 /// <param name="applyTo">The apply to.</param>
 /// <param name="roles">  A variable-length parameters list containing roles.</param>
 public RequiredRoleAttribute(ApplyTo applyTo, params string[] roles)
 {
     this.RequiredRoles = roles.ToList();
     this.ApplyTo       = applyTo;
     this.Priority      = (int)RequestFilterPriority.RequiredRole;
 }
Пример #24
0
 public CustomRequestFilterAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
 }
 /// <summary>
 /// Creates a new <see cref="RequestFilterAttribute"/>
 /// </summary>
 /// <param name="applyTo">Defines when the filter should be executed</param>
 public RequestFilterAttribute(ApplyTo applyTo)
 {
     ApplyTo = applyTo;
 }
 public AuthenticateAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
 }
 public AuthenticateAttribute(ApplyTo applyTo)
 {
     this.ApplyTo = applyTo;
 }
Пример #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TagAttribute"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="applyTo">The apply to.</param>
 public TagAttribute(string name, ApplyTo applyTo)
 {
     Name    = name;
     ApplyTo = applyTo;
 }
 public UpdateScheduledEvent(ApplyTo updateStrategy, string eventId, TEvent changes)
 {
     Changes        = changes;
     EventId        = eventId;
     UpdateStrategy = updateStrategy;
 }
Пример #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpHeaderAttribute"/>
 /// class that applies to the HTTP  methods defined by the flag
 /// <paramref name="apply_to"/> and uses the default authentication
 /// challenge.
 /// </summary>
 /// <param name="apply_to">
 /// A flag that indicates for which method this attribute should be applied.
 /// </param>
 public HttpHeaderAttribute(ApplyTo apply_to) : base(apply_to) {
   Value = string.Empty;
 }
Пример #31
0
 public static IServiceRoutes Add <T>(this IServiceRoutes serviceRoutes, string restPath, ApplyTo verbs, params Expression <Func <T, object> >[] propertyExpressions)
 {
     return(serviceRoutes.Add <T>(FormatRoute(restPath, propertyExpressions), verbs));
 }
 public RequiredPermissionAttribute(ApplyTo applyTo, params string[] permissions)
 {
     this.RequiredPermissions = permissions.ToList();
     this.ApplyTo = applyTo;
 }
Пример #33
0
 public static IServiceRoutes Add(this IServiceRoutes routes, Type requestType, string restPath, ApplyTo verbs)
 {
     return(routes.Add(requestType, restPath, verbs.ToVerbsString()));
 }
 public WebSudoRequiredAttribute(ApplyTo applyTo)
 {
     this.ApplyTo  = applyTo;
     this.Priority = -79;
 }
Пример #35
0
 /// <summary>Initializes a new instance of the NServiceKit.ServiceInterface.RequiresAnyPermissionAttribute class.</summary>
 ///
 /// <param name="applyTo">    The apply to.</param>
 /// <param name="permissions">A variable-length parameters list containing permissions.</param>
 public RequiresAnyPermissionAttribute(ApplyTo applyTo, params string[] permissions)
 {
     this.RequiredPermissions = permissions.ToList();
     this.ApplyTo = applyTo;
     this.Priority = (int)RequestFilterPriority.RequiredPermission;
 }
        /// <summary>
        /// Performs validation and then throws an exception if validation fails.
        /// </summary>
        /// <param name="validator">The validator this method is extending.</param>
        /// <param name="instance">The instance of the type we are validating.</param>
        /// <param name="applyTo">The ruleset to validate against.</param>
        public static void ValidateAndThrow <T>(this IValidator <T> validator, T instance, ApplyTo applyTo)
        {
            var ruleSet = applyTo.ToString().ToUpper();

            validator.Validate(instance, options => {
                options.IncludeRuleSets(RulesetValidatorSelector.LegacyRulesetSplit(ruleSet));
                options.ThrowOnFailures();
            });
        }
Пример #37
0
 /// <summary>Runs.</summary>
 ///
 /// <param name="request">The request.</param>
 /// <param name="method"> The method.</param>
 ///
 /// <returns>An object.</returns>
 protected virtual object Run(TRequest request, ApplyTo method)
 {
     return(request.AsTypeString());
 }
 /// <summary>
 /// Performs validation asynchronously and then throws an exception if validation fails.
 /// </summary>
 /// <param name="validator">The validator this method is extending.</param>
 /// <param name="instance">The instance of the type we are validating.</param>
 /// <param name="applyTo">Optional: a ruleset when need to validate against.</param>
 /// <param name="token"></param>
 public static async Task ValidateAndThrowAsync <T>(this IValidator <T> validator, T instance, ApplyTo applyTo, CancellationToken token = new())
 /// <summary>
 /// Creates a new <see cref="ResponseFilterAttribute"/>
 /// </summary>
 /// <param name="applyTo">Defines when the filter should be executed</param>
 public ResponseFilterAttribute(ApplyTo applyTo)
 {
     ApplyTo = applyTo;
 }
Пример #40
0
 public AuthenticateAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
 }
Пример #41
0
 public AuthenticateAttribute(ApplyTo applyTo, string provider)
     : this(applyTo)
 {
     this.Provider = provider;
 }
Пример #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecureAttribute"/> class
 /// that applies to the HTTP  methods defined by the flag
 /// <paramref name="apply_to"/> and uses the default authentication
 /// challenge.
 /// </summary>
 /// <param name="apply_to">
 /// A flag that indicates for which method this attribute should be applied.
 /// </param>
 public SecureAttribute(ApplyTo apply_to)
     : this(apply_to, kWwwAuthenticateHeader)
 {
 }
 /// <summary>
 /// Creates a new <see cref="ResponseFilterAttribute"/>
 /// </summary>
 /// <param name="applyTo">Defines when the filter should be executed</param>
 public ResponseFilterAttribute(ApplyTo applyTo)
 {
     ApplyTo = applyTo;
 }
Пример #44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SecureAttribute"/> class
 /// that applies to the HTTP  methods defined by the flag
 /// <paramref name="apply_to"/> and uses the default authentication
 /// challenge.
 /// </summary>
 /// <param name="apply_to">
 /// A flag that indicates for which method this attribute should be applied.
 /// </param>
 /// <param name="challenge">
 /// The string that is used to challenge the client request. This string
 /// will be added to the WWW-Authenticate header when a subject is not
 /// authenticated.
 /// </param>
 public SecureAttribute(ApplyTo apply_to, string challenge) : base(apply_to)
 {
     Challenge = challenge ?? kWwwAuthenticateHeader;
 }
 /// <summary>
 /// Creates a new <see cref="RequestFilterAttribute"/>
 /// </summary>
 /// <param name="applyTo">Defines when the filter should be executed</param>
 public RequestFilterAttribute(ApplyTo applyTo) => ApplyTo = applyTo;
 public ResponseFilterAttribute()
 {
     ApplyTo = ApplyTo.All;
 }
 public RequiredRoleAttribute(ApplyTo applyTo, params string[] roles)
 {
     this.RequiredRoles = roles.ToList();
     this.ApplyTo = applyTo;
 }
Пример #48
0
		public RoleAttribute(ApplyTo applyTo, params string[] roles)
			:base(applyTo, roles) {}
 public RequestFilterAttribute()
 {
     ApplyTo = ApplyTo.All;
 }
 /// <summary>
 /// Performs validation and then throws an exception if validation fails.
 /// </summary>
 /// <param name="validator">The validator this method is extending.</param>
 /// <param name="instance">The instance of the type we are validating.</param>
 /// <param name="ruleSet">The ruleset to validate against.</param>
 public static void ValidateAndThrow <T>(this IValidator <T> validator, T instance, ApplyTo ruleSet)
 {
     validator.ValidateAndThrow(instance, ruleSet.ToString().ToUpper());
 }
Пример #51
0
 public AuthenticateAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
     this.Priority = (int)RequestFilterPriority.Authenticate;
 }
 /// <summary>
 /// Performs validation asynchronously and then throws an exception if validation fails.
 /// </summary>
 /// <param name="validator">The validator this method is extending.</param>
 /// <param name="instance">The instance of the type we are validating.</param>
 /// <param name="ruleSet">Optional: a ruleset when need to validate against.</param>
 public static Task ValidateAndThrowAsync <T>(this IValidator <T> validator, T instance, ApplyTo ruleSet)
 {
     return(validator.ValidateAndThrowAsync(instance, ruleSet.ToString().ToUpper()));
 }
Пример #53
0
 public RequiredRoleAttribute(ApplyTo applyTo, params string[] roles)
 {
     this.RequiredRoles = roles.ToList();
     this.ApplyTo = applyTo;
     this.Priority = (int) RequestFilterPriority.RequiredRole;
 }
Пример #54
0
 public SecuredAttribute(ApplyTo applyTo)
     : base(applyTo)
 {
 }