/// <summary>
 /// </summary>
 /// <param name="defaultAuthorizer">This will be used unless the object type exactly matches one of the typeAuthorizers</param>
 /// <param name="typeAuthorizers">Each authorizer must implement ITypeAuthorizer of T, where T is a concrete domain type</param>
 public CustomAuthorizationManager(ITypeAuthorizer<object> defaultAuthorizer, params object[] typeAuthorizers)
     : this(defaultAuthorizer) {
     foreach (object typeAuth in typeAuthorizers) {
         Type authInt = typeAuth.GetType().GetInterface("ITypeAuthorizer`1");
         if (authInt != null && !(authInt.GetGenericArguments()[0]).IsAbstract) {
             Type domainType = authInt.GetGenericArguments()[0];
             typeAuthorizerMap.Add(domainType, typeAuth);
         }
         else {
             throw new InitialisationException("Attempting to specify a typeAuthorizer that does not implement ITypeAuthorizer<T>, where T is concrete");
         }
     }
 }
Ejemplo n.º 2
0
        internal static Activity LoadXomlDocument(WorkflowMarkupSerializationManager xomlSerializationManager, XmlReader textReader, string fileName, ITypeAuthorizer typeAuthorizer)
        {
            if (xomlSerializationManager == null)
            {
                throw new ArgumentNullException("xomlSerializationManager");
            }

            Activity rootActivity = null;

            try
            {
                xomlSerializationManager.Context.Push(fileName);
                WorkflowMarkupSerializationHelpers.TypeAuthorizer = typeAuthorizer;
                rootActivity = new WorkflowMarkupSerializer().Deserialize(xomlSerializationManager, textReader) as Activity;
            }
            finally
            {
                xomlSerializationManager.Context.Pop();
            }

            return(rootActivity);
        }
 public CustomAuthorizationManager(ITypeAuthorizer<object> defaultAuthorizer, params INamespaceAuthorizer[] namespaceAuthorizers)
     : this(defaultAuthorizer) {
     this.namespaceAuthorizers = namespaceAuthorizers;
 }
 public CustomAuthorizationManager(ITypeAuthorizer<object> defaultAuthorizer) {
     if (defaultAuthorizer == null) throw new InitialisationException("Default Authorizer cannot be null");
     this.defaultAuthorizer = defaultAuthorizer;
 }
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer);
 }
 /// <summary>
 /// </summary>
 /// <param name="defaultAuthorizer">This will be used unless the object is recognised by one of the namespaceAuthorizers</param>
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer, params INamespaceAuthorizer[] namespaceAuthorizers) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer, namespaceAuthorizers);
 }
 /// <summary>
 /// </summary>
 /// <param name="defaultAuthorizer">This will be used unless the object type exactly matches one of the typeauthorizers</param>
 /// <param name="typeAuthorizers">Each authorizer must implement ITypeAuthorizer for a concrete domain type</param>
 public CustomAuthorizerInstaller(ITypeAuthorizer<object> defaultAuthorizer, params object[] typeAuthorizers) {
     authManager = new CustomAuthorizationManager(defaultAuthorizer, typeAuthorizers);
 }