Arbitrary options to be passed into various operations.
This serves as a catch-all for extra options.
 public ISubscription Subscribe(ObjectClass objectClass, Filter eventFilter, IObserver<ConnectorObject> handler,
     OperationOptions operationOptions)
 {
     return ((IConnectorEventSubscriptionApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<IConnectorEventSubscriptionApiOp>()))
      .Subscribe(objectClass, eventFilter, handler, operationOptions);
 }
 public Object RunScriptOnResource(ScriptContext request,
     OperationOptions options)
 {
     return ((ScriptOnResourceApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<ScriptOnResourceApiOp>()))
             .RunScriptOnResource(request, options);
 }
 public SearchResult Search(ObjectClass objectClass, Filter filter, ResultsHandler handler, OperationOptions options)
 {
     return ((SearchApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<SearchApiOp>())).Search(
             objectClass, filter, handler, options);
 }
 /// <summary>
 /// Implementation of UpdateOp.Update
 /// </summary>
 /// <param name="type">Update type</param>
 /// <param name="oclass">Object class</param>
 /// <param name="attributes">Object attributes</param>
 /// <param name="options">Operation options</param>
 /// <returns><see cref="Uid"/> of the updated object</returns>
 public override Uid Update(
     UpdateType type,
     ObjectClass oclass,
     ICollection<ConnectorAttribute> attributes,
     OperationOptions options)
 {
     // TODO: Implement Update
     return base.Update(type, oclass, attributes, options);
 }
 public ConnectorObject GetConnectorObjectFromUid(
     ActiveDirectoryConnector connector, ObjectClass oclass, Uid uid,
     OperationOptions options)
 {
     // get sid to check permissions
     Filter uidFilter = FilterBuilder.EqualTo(uid);
     ICollection<ConnectorObject> objects = TestHelpers.SearchToList(connector,
         oclass, uidFilter, options);
     Assert.AreEqual(1, objects.Count);
     return objects.ElementAt(0);
 }
 public Uid Update(ObjectClass objclass, Uid uid, ICollection<ConnectorAttribute> attrs, OperationOptions options)
 {
     return ((UpdateApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<UpdateApiOp>()))
             .Update(objclass, uid, attrs, options);
 }
 /// <summary>
 /// Implementation of SearchOp.ExecuteQuery
 /// </summary>
 /// <param name="oclass">Object class</param>
 /// <param name="query">Query to execute</param>
 /// <param name="handler">Result handler</param>
 /// <param name="options">Operation options</param>
 public override void ExecuteQuery(
     ObjectClass oclass,
     string query,
     ResultsHandler handler,
     OperationOptions options)
 {
     // TODO: Implement ExecuteQuery
     base.ExecuteQuery(oclass, query, handler, options);
 }
 /// <summary>
 /// Create a builder from an existing set of options.
 /// </summary>
 /// <param name="options">The existing set of options. Must not be null.</param>
 public OperationOptionsBuilder(OperationOptions options)
 {
     Assertions.NullCheck(options, "options");
     // clone options to do a deep copy in case anything
     // is an array
     IDictionary<Object, Object> operationOptionsClone = (IDictionary<Object, Object>)SerializerUtil
             .CloneObject(options.Options);
     _options = CollectionUtil.NewDictionary<object, object, string, object>(operationOptionsClone);
 }
 public Uid Authenticate(ObjectClass objectClass, String username, GuardedString password, OperationOptions options)
 {
     return ((AuthenticationApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<AuthenticationApiOp>())).Authenticate(
             objectClass, username, password, options);
 }
 public FilterTranslator<string> CreateFilterTranslator(ExchangeConnector connector, ObjectClass oclass, OperationOptions options)
 {
     return new ActiveDirectoryFilterTranslator();
 }
Exemple #11
0
 public Object RunScriptOnConnector(ScriptContext request,
     OperationOptions options)
 {
     return ((ScriptOnConnectorApiOp)this
             .GetOperationCheckSupported(SafeType<APIOperation>.Get<ScriptOnConnectorApiOp>()))
             .RunScriptOnConnector(request, options);
 }
 public Uid Create(ObjectClass oclass, ICollection<ConnectorAttribute> attrs, OperationOptions options)
 {
     String version = "2.0";
     return new Uid(version);
 }
        /// <summary>
        /// Builds new Operation options and add the specified attribute names as 
        /// AttributesToGet (add to existing AttributesToGet)
        /// </summary>
        /// <param name="options">Existing Operation Options</param>
        /// <param name="attNames">attribute names to be add to AttributeToGet</param>
        /// <returns>New Operation Options</returns>
        internal static OperationOptions AddAttributeToOptions(OperationOptions options, params string[] attNames)
        {
            OperationOptionsBuilder optionsBuilder = new OperationOptionsBuilder(options);
            List<string> attsToGet = new List<string>();
            if (options.AttributesToGet != null)
            {
                attsToGet.AddRange(options.AttributesToGet);
            }

            foreach (string attName in attNames)
            {
                attsToGet.Add(attName);
            }

            optionsBuilder.AttributesToGet = attsToGet.ToArray();
            return optionsBuilder.Build();
        }
Exemple #14
0
 public void Search(ObjectClass oclass, Filter filter, ResultsHandler handler, OperationOptions options)
 {
     ((SearchApiOp)this.GetOperationCheckSupported(SafeType<APIOperation>.Get<SearchApiOp>())).Search(
             oclass, filter, handler, options);
 }
 public ISubscription Subscribe(ObjectClass objectClass, SyncToken token, IObserver<SyncDelta> handler, OperationOptions operationOptions)
 {
     return ((ISyncEventSubscriptionApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<ISyncEventSubscriptionApiOp>()))
      .Subscribe(objectClass, token, handler, operationOptions);
 }
 public Uid Create(ObjectClass oclass, ICollection<ConnectorAttribute> attrs, OperationOptions options)
 {
     return ((CreateApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<CreateApiOp>())).Create(oclass, attrs, options);
 }
 public SyncToken Sync(ObjectClass objectClass, SyncToken token,
     SyncResultsHandler handler,
     OperationOptions options)
 {
     return ((SyncApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<SyncApiOp>()))
     .Sync(objectClass, token, handler, options);
 }
 public void Delete(ObjectClass objClass, Uid uid, OperationOptions options)
 {
     ((DeleteApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<DeleteApiOp>()))
         .Delete(objClass, uid, options);
 }
 /// <summary>
 /// Implementation of SearchOp.CreateFilterTranslator
 /// </summary>
 /// <param name="oclass">Object class</param>
 /// <param name="options">Operation options</param>
 /// <returns>Exchange specific Filter translator</returns>
 public override Org.IdentityConnectors.Framework.Common.Objects.Filters.FilterTranslator<string> CreateFilterTranslator(
     ObjectClass oclass,
     OperationOptions options)
 {
     // TODO: Implement CreateFilterTranslator
     return base.CreateFilterTranslator(oclass, options);
 }
 public ConnectorObject GetObject(ObjectClass objClass, Uid uid, OperationOptions options)
 {
     return ((GetApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<GetApiOp>()))
             .GetObject(objClass, uid, options);
 }
 /// <summary>
 /// Implementation of SynOp.Sync
 /// </summary>
 /// <param name="objClass">Object class</param>
 /// <param name="token">Syncronization token</param>
 /// <param name="handler">Handler for syncronization results</param>
 /// <param name="options">Operation options, can be null</param>
 public override void Sync(
     ObjectClass objClass,
     SyncToken token,
     SyncResultsHandler handler,
     OperationOptions options)
 {
     // TODO: implement Sync
     base.Sync(objClass, token, handler, options);
 }
 public Uid ResolveUsername(ObjectClass objectClass, String username, OperationOptions options)
 {
     return ((ResolveUsernameApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<ResolveUsernameApiOp>())).ResolveUsername(
             objectClass, username, options);
 }
        /// <summary>
        /// Implementation of CreateOp.Create
        /// </summary>
        /// <param name="oclass">Object class</param>(oc
        /// <param name="attributes">Object attributes</param>
        /// <param name="options">Operation options</param>
        /// <returns><see cref="Uid"/> of the created object</returns>
        public override Uid Create(
            ObjectClass oclass,
            ICollection<ConnectorAttribute> attributes,
            OperationOptions options)
        {
            const string METHOD = "Create";
            Debug.WriteLine(METHOD + ":entry", ClassName);

            // first create the object in AD
            Uid uid = base.Create(oclass, attributes, options);

            try
            {
                if (oclass.Is(MailboxName))
                {
                    // enable mailbox for person
                    Command cmd = ExchangeUtility.GetCommand(CommandInfo.EnableMailbox, attributes, this.configuration);
                    this.runspace.InvokePipeline(cmd);
                }
                else if (oclass.Is(MailUserName))
                {
                    // enable mailuser
                    Command cmd = ExchangeUtility.GetCommand(CommandInfo.EnableMailUser, attributes, this.configuration);
                    this.runspace.InvokePipeline(cmd);
                }

                Debug.WriteLine(METHOD + ":exit", ClassName);
            }
            catch
            {
                // do the rollback - delete the object by uid
                // no need to check the uid is null, ensured by the create contract
                this.Delete(oclass, uid, options);
                throw;
            }

            return uid;
        }
        public Uid UpdateAddAndVerifyUser(ActiveDirectoryConnector connector,
            ObjectClass oclass, Uid uid, ICollection<ConnectorAttribute> attributes,
            OperationOptions searchOptions)
        {
            // find the existing one, and save off all attributes
            Filter uidFilter = FilterBuilder.EqualTo(uid);
            ICollection<ConnectorObject> currentObjects = TestHelpers.SearchToList(
                connector, oclass, uidFilter, searchOptions);
            Assert.IsTrue(currentObjects.Count == 1);
            ICollection<ConnectorAttribute> currentAttributes =
                currentObjects.ElementAt(0).GetAttributes();

            // build a list that has the 'added' values added to the existing values
            ICollection<ConnectorAttribute> comparisonAttributes = new List<ConnectorAttribute>();
            foreach (ConnectorAttribute updateAttribute in attributes)
            {
                ConnectorAttribute existingAttribute = ConnectorAttributeUtil.Find(
                    updateAttribute.Name, currentAttributes);
                comparisonAttributes.Add(AttConcat(updateAttribute, existingAttribute));
            }

            // make sure the uid is present in the attributes
            attributes.Add(uid);
            // now update with ADD to add additional home phones
            Uid updatedUid = connector.Update(UpdateType.ADD, oclass,
                attributes, null);

            // find it back
            ICollection<ConnectorObject> updatedObjects = TestHelpers.SearchToList(
                connector, oclass, uidFilter, searchOptions);
            Assert.IsTrue(updatedObjects.Count == 1);

            VerifyObject(comparisonAttributes, updatedObjects.ElementAt(0));

            return updatedUid;
        }