Esempio n. 1
0
        private bool SendNotification(ServicesGroupServiceClient groupClient, TaskScheduling task, List <Group> groups, int processedFailed, int processedSuccessFully, string clientID = "")
        {
            bool flag;

            if (this.NeedNotify(task, processedFailed, processedSuccessFully))
            {
                try
                {
                    List <Group> compressedList = Helper.PrepareCompressedData(groups);
                    Console.WriteLine(string.Concat(Environment.NewLine, "SENDING NOTIFICATION THROUGH GROUP CLIENT FOR CLIENT ", clientID, Environment.NewLine));
                    groupClient.SendUpdateNotification(task.get_IdentityStoreId(), compressedList, task.get_SendToSpecified(), task.get_SendToOwner(), task.get_SendOnUpdate(), clientID);
                    flag = true;
                }
                catch (Exception exception)
                {
                    this.logger.Error("Error occurred while sending smart group update notifications. ", exception);
                    flag = false;
                }
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
Esempio n. 2
0
        public void ProcessJob(TaskScheduling task)
        {
            ServicesAdministrationServiceClient adminClient = new ServicesAdministrationServiceClient(true);
            List <StoreType> storeTypes = adminClient.LoadAllStoreTypes();

            adminClient.LoadAllIdentityStores().ForEach((IdentityStore store) => {
                if (store.get_StoreType() == null)
                {
                    StoreType storeType = storeTypes.Find((StoreType st) => st.get_StoreTypeId() == store.get_StoreTypeId());
                    if (storeType != null)
                    {
                        store.set_StoreType(storeType);
                    }
                }
                this.ReplicateStore(store);
            });
            try
            {
                ActionResult result = (new ServicesAdministrationServiceClient(true)).EnsureSchemaLinkAttributeIsUptoDate();
                Helper.LogDebugResults(SchemaReplicationProcessor.logger, result, "Schema link attribute update ");
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                string    message   = string.Concat("Error occurred while updating the schema link attribute. Reason: ", exception.Message);
                LogExtension.LogException(SchemaReplicationProcessor.logger, message, exception);
            }
            SchemaReplicationProcessor.logger.InfoFormat("Job processed successfully.", Array.Empty <object>());
        }
 public void ProcessJob(TaskScheduling task)
 {
     try
     {
         ActionResult result = (new WorkflowManagerServiceClient(false)).ProcessApproverAcceleration(task.get_IdentityStoreId());
         WorkflowApproverAccelerationProcessor.logger.Debug(1023, 10334, string.Format("Workflow approver acceleration result: {0}. {1}", result.get_Status(), result.get_Message()), null, null);
     }
     catch (Exception exception)
     {
         Exception ex  = exception;
         string    msg = string.Concat("Unable to accelerate the workflow approvers. ", ex.Message);
         WorkflowApproverAccelerationProcessor.logger.Error(1023, 10334, msg, ex, null);
     }
 }
        public void ProcessJob(TaskScheduling task)
        {
            (new ExpiredGroupsProcessor()).DeleteTheExpiredGroupsWhichAreDueForDeletion();
            ExpiringGroupsProcessor expiringGroupsProcessor = new ExpiringGroupsProcessor();

            expiringGroupsProcessor.ExpireTheGroupsWhichAreDueForExpiry();
            EligibleGroupsForLifeExtensionProcessor eligibleGroupsForLifeExtensionProcessor = new EligibleGroupsForLifeExtensionProcessor();

            eligibleGroupsForLifeExtensionProcessor.ExtendEligibleGroupsLife();
            if (eligibleGroupsForLifeExtensionProcessor.ExtendedGroups.Count > 0)
            {
                expiringGroupsProcessor.ExtendedGroups = eligibleGroupsForLifeExtensionProcessor.ExtendedGroups;
            }
            expiringGroupsProcessor.SendNotificationToExpiringGroups();
            Imanami.GroupID.TaskScheduler.Glm.JobProcessor.logger.InfoFormat("Processed job.", Array.Empty <object>());
        }
 public void ProcessJob(TaskScheduling task)
 {
     try
     {
         ServicesAdministrationServiceClient adminClient  = new ServicesAdministrationServiceClient(true);
         ServicesSearchServiceClient         searchClient = new ServicesSearchServiceClient(false);
         IdentityStore   store                   = adminClient.GetIdentityStoreById(task.get_IdentityStoreId(), true);
         KnownAttributes knownAttributes         = searchClient.GetKnownAttributes(task.get_IdentityStoreId());
         List <PermissionAnalyzerServer> servers = new List <PermissionAnalyzerServer>();
         Dictionary <string, Dictionary <int, string> > configurations = this.LoadConfigurations(store, adminClient, servers, knownAttributes);
         List <Schema> schema = adminClient.GetIdentityStoreSchema(task.get_IdentityStoreId());
         if (servers.Count > 0)
         {
             (new Imanami.PermissionReplicationService.PermissionReplicationService(store, configurations, schema, knownAttributes)).ReplicatePermissions(1, servers);
         }
     }
     catch (Exception exception)
     {
         LogExtension.LogException(PermissionAnalyzer.logger, "Error While Replicating Permissions.", exception);
     }
     PermissionAnalyzer.logger.InfoFormat("Job processed successfully.", Array.Empty <object>());
 }
Esempio n. 6
0
        private static void ProcessCommandLineArgs(Options opts)
        {
            if (opts.StartDebugger)
            {
                if (!Debugger.IsAttached)
                {
                    Debugger.Launch();
                }
            }

            if (opts.CreateStartupEntry)
            {
                TaskScheduling.CreateOotDStartupTask(_logger);
                Environment.Exit(0);
            }

            if (opts.RemoveStartupEntry)
            {
                TaskScheduling.RemoveOotDStartupTask(_logger);
                Environment.Exit(0);
            }
        }
Esempio n. 7
0
        private bool NeedNotify(TaskScheduling task, int processedFailed, int processedSuccessFully)
        {
            bool flag;

            if (!task.get_SendReport())
            {
                flag = false;
            }
            else if ((!task.get_SendOnFailure() ? false : processedFailed > 0))
            {
                flag = true;
            }
            else if ((!task.get_SendOnSuccess() ? true : processedSuccessFully <= 0))
            {
                flag = ((!task.get_SendOnUpdate() ? true : processedSuccessFully <= 0) ? false : true);
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
Esempio n. 8
0
 public void ProcessSmartGroupUpdate(TaskScheduling task)
 {
     //
     // Current member / type: System.Void Imanami.GroupID.TaskScheduler.SmartGroupJobProcessor::ProcessSmartGroupUpdate(Imanami.GroupID.DataTransferObjects.DataContracts.Services.Scheduling.TaskScheduling)
     // File path: C:\Users\Administrator.ERISED\Desktop\Production\Imanami.GroupID.TaskScheduler.exe
     //
     // Product version: 2019.1.118.0
     // Exception in: System.Void ProcessSmartGroupUpdate(Imanami.GroupID.DataTransferObjects.DataContracts.Services.Scheduling.TaskScheduling)
     //
     // Object reference not set to an instance of an object.
     //    at ž..•( ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Steps\RenameEnumValues.cs:line 77
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 87
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit( ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 322
     //    at †”.‰Ÿ.•( ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 499
     //    at ž..•( ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Steps\RenameEnumValues.cs:line 68
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 87
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•( ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 383
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 59
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 49
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•(IfStatement ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 361
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 55
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 49
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•(IfStatement ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 361
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 55
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 49
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•(IfStatement ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 361
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 55
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 49
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•(IfStatement ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 361
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 55
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 49
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.•(ForEachStatement ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 442
     //    at †”.‰Ÿ.—š(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 73
     //    at †”.‰Ÿ.Visit(ICodeNode ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 276
     //    at †”.‰Ÿ.Visit[„Ÿ,†Ÿ](„Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 286
     //    at †”.‰Ÿ.Visit(‰ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 317
     //    at †”.‰Ÿ.”(•Ÿ ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\BaseCodeTransformer.cs:line 337
     //    at ž..œ(DecompilationContext ™, •Ÿ Ÿ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Steps\RenameEnumValues.cs:line 48
     //    at ‚–.™“.(MethodBody €–, •Ÿ Ÿ, ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88
     //    at ‚–.™“.‹(MethodBody €–, ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70
     //    at Telerik.JustDecompiler.Decompiler.Extensions.›“(™“ œ“, ILanguage , MethodBody €–, DecompilationContext& ™) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 95
     //    at Telerik.JustDecompiler.Decompiler.Extensions.š“(MethodBody €–, ILanguage , DecompilationContext& ™,  œ–) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 58
     //    at ——.ƒ˜.—(ILanguage , MethodDefinition €,  œ–) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 117
     //
     // mailto: [email protected]
 }
Esempio n. 9
0
        public void ProcessJob(long jobId)
        {
            TaskScheduling task = (new ServicesSchedulingServiceClient(true)).GetScheduledJob(jobId);

            Console.WriteLine(string.Concat("Task ", task.get_TaskSchedulerJobName(), " obtained using scheduling client."));
            Console.WriteLine(string.Format("Job ID: {0}", jobId));
            Imanami.GroupID.TaskScheduler.Helper.CurrentTask = task;
            if (Imanami.GroupID.TaskScheduler.Helper.CurrentTask != null)
            {
                if ((Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobType() == 6 || !Imanami.GroupID.TaskScheduler.Helper.IsSystemSecurityContext || Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobType() == 8 ? false : Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobType() != 13))
                {
                    string exMsg = string.Format("Unable to proceed. Authentication information has been expired for job {0} - {1}.", task.get_JobId(), task.get_Name());
                    Console.WriteLine(string.Concat("Throwing exception: ", exMsg));
                    throw new Exception(exMsg);
                }
                ServicesSearchServiceClient configurationService = new ServicesSearchServiceClient(false);
                Imanami.GroupID.TaskScheduler.Helper.AppConfiguration = configurationService.GetAppConfiguration(Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_IdentityStoreId());
                if (Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobType() != 6)
                {
                    Imanami.GroupID.TaskScheduler.Helper.KnownProviderAttributes = configurationService.GetKnownAttributes(Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_IdentityStoreId());
                }
                Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobId(), Imanami.GroupID.TaskScheduler.Helper.CurrentTask.get_JobName());
                if (task.get_JobType() == 9)
                {
                    IUserLifeCycleJob userLifeCycleProcessor = Imanami.GroupID.UserLifeCycleManagment.Helpers.Helper.GetUserLifeCycleJobProcessor();
                    Imanami.GroupID.UserLifeCycleManagment.Helpers.Helper.set_KnownProviderAttributes(Imanami.GroupID.TaskScheduler.Helper.KnownProviderAttributes);
                    userLifeCycleProcessor.Process(task);
                }
                else if (task.get_JobType() == 1)
                {
                    Console.WriteLine(string.Format("Job type is {0}", task.get_JobType()));
                    SmartGroupJobProcessor processor = new SmartGroupJobProcessor();
                    Console.WriteLine("Ready to process smart group job");
                    processor.ProcessSmartGroupUpdate(task);
                }
                else if (task.get_JobType() == 5)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    MembershipJob.RunMembershipLifeCycle(task.get_IdentityStoreId());
                }
                else if (task.get_JobType() == 11)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    ManagedByJobs.RunManagedByLifeCycle(task.get_IdentityStoreId());
                }
                else if (task.get_JobType() == 4)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new Imanami.GroupID.TaskScheduler.Glm.JobProcessor()).ProcessJob(task);
                }
                else if (task.get_JobType() == 6)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new SchemaReplicationProcessor()).ProcessJob(task);
                }
                else if (task.get_JobType() == 7)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new Imanami.GroupID.TaskScheduler.GUS.JobProcessor()).ProcessGroupUsage();
                }
                else if (task.get_JobType() == 8)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new ServicesSchedulingServiceClient(false)).HistoryRetention(task);
                }
                else if (task.get_JobType() == 10)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new OrphanGroupProcessor()).ProcessJob(task);
                }
                else if (task.get_JobType() == 12)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new WorkflowApproverAccelerationProcessor()).ProcessJob(task);
                }
                else if (task.get_JobType() == 13)
                {
                    Imanami.GroupID.TaskScheduler.JobProcessor.logger.InfoFormat("Processing job: {0}, Name: {1}", task.get_JobId(), task.get_JobName());
                    (new PermissionAnalyzer()).ProcessJob(task);
                }
            }
        }
Esempio n. 10
0
 private static void Main(string[] args)
 {
     Console.Title = "Task Scheduler Runner";
     args          = new string[] { "0AA##0PV7M#AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABOimvGWmYk+OwElU3xgGewQAAAACAAAAAAADZgAAwAAAABAAAAA+yg5rxV+6laCj+NmjyzUUAAAAAASAAACgAAAAEAAAALBk/IjhAvXRv7AKRVRSFxIIAAAA0wsOxFN3pAAUAAAALS5bfTs3WJzAPK4Tn+V3EK5mLC8=Ukx5N0AlazM=" };
     Console.WriteLine("Press any key to start...");
     Console.ReadKey(false);
     try
     {
         try
         {
             Console.WriteLine("Program Started");
             LogExtension.RegisterCustomLogLevels();
             XmlConfigurator.Configure();
             LogExtension.EnterMethod(Program.logger, MethodBase.GetCurrentMethod(), args);
             string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Schedules");
             Console.WriteLine(string.Concat("Schedules Path: ", path));
             int jobId = Convert.ToInt32(CryptographyHelper.DecryptFromLocalMachine(args[0]));
             Console.WriteLine(string.Format("Job ID: {0}", jobId));
             path = Path.Combine(path, string.Concat("task", jobId.ToString(), ".txt"));
             if (!File.Exists(path))
             {
                 Console.WriteLine(string.Concat("Path ", path, " does not exists."));
                 Program.InitializeSystemSecurityContext();
                 Helper.IsSystemSecurityContext = true;
             }
             else
             {
                 Console.WriteLine(string.Concat("Path ", path, " exists."));
                 using (StreamReader data = File.OpenText(path))
                 {
                     string[] container = data.ReadToEnd().Split(new string[] { "<#!#>" }, StringSplitOptions.None);
                     jobId = Convert.ToInt32(CryptographyHelper.DecryptFromLocalMachine(container[0]));
                     Console.WriteLine(string.Format("Job ID from job file: {0}", jobId));
                     Program.InitializeSecurityContext(CryptographyHelper.DecryptFromLocalMachine(container[2]));
                     Helper.IsSystemSecurityContext = false;
                 }
             }
             Console.WriteLine("System security context initialized");
             LicensingProvider licensingProvider = new LicensingProvider();
             if ((licensingProvider.HasValidProductLicense(1) ? false : !licensingProvider.HasValidProductLicense(3)))
             {
                 if (!licensingProvider.HasValidProductLicense(8))
                 {
                     Console.WriteLine("License error. Returning...");
                     Program.logger.Error("Invalid License");
                     return;
                 }
                 else
                 {
                     TaskScheduling task = (new ServicesSchedulingServiceClient(true)).GetScheduledJob((long)jobId);
                     if (task == null)
                     {
                         return;
                     }
                     else if (task.get_JobType() != 13)
                     {
                         Program.logger.Error("Invalid License");
                         Console.WriteLine("License error. Returning...");
                         return;
                     }
                 }
             }
             JobProcessor jobProcessor = new JobProcessor();
             Console.WriteLine(string.Format("Ready to process job {0}", jobId));
             jobProcessor.ProcessJob((long)jobId);
             Console.WriteLine(string.Format("Job {0} processed.", jobId));
         }
         catch (CryptographicException cryptographicException1)
         {
             CryptographicException cryptographicException = cryptographicException1;
             string message = string.Concat(cryptographicException.Message, " Error in initializing security context for the Scheduled job. Possible reason may be, that a required windows service is not running. Please make sure that 'CNG Key Isolation' windows service is running.");
             Console.WriteLine(string.Format("Exception {0}: {1}. Details: {2}. Trace:", cryptographicException.GetType(), cryptographicException.Message, message));
             Console.WriteLine(cryptographicException.StackTrace);
             LogExtension.LogException(Program.logger, message, cryptographicException, 1, "Logging.Const.LoggingConstants.jobUpdate");
         }
         catch (Exception exception)
         {
             Exception ex = exception;
             Console.WriteLine(string.Format("Exception {0}: {1}. Trace:", ex.GetType(), ex.Message));
             Console.WriteLine(ex.StackTrace);
             LogExtension.LogException(Program.logger, ex.Message, ex, 1, "Logging.Const.LoggingConstants.jobUpdate");
         }
     }
     finally
     {
         LogExtension.ExitMethod(Program.logger, MethodBase.GetCurrentMethod(), args);
     }
 }
        public void ProcessJob(TaskScheduling task)
        {
            List <User> ownerUsers = new List <User>();
            List <IdentityStoreObject> orphanGrps      = this.GetOrphanGroups(null);
            IStoreTypeHelper           storeHelper     = Helper.GetStoreTypeHelper(Helper.CurrentTask.get_IdentityStoreId());
            ILookup <string, User>     addOwnersLookup = null;
            List <string> supportedObjectTypes         = new List <string>();

            if (storeHelper != null)
            {
                supportedObjectTypes = storeHelper.GetSupportedObjectTypes(Helper.KnownProviderAttributes.get_Owner());
                if (supportedObjectTypes.Count > 0)
                {
                    List <string> strs1 = new List <string>();
                    orphanGrps.ForEach((IdentityStoreObject g) => {
                        List <string> strs = strs1;
                        List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> values = g.get_AttributesBusinessObject().GetValues("XAdditionalOwner");
                        Func <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute, string> u003cu003e9_12 = OrphanGroupProcessor.< > c.< > 9__1_2;
                        if (u003cu003e9_12 == null)
                        {
                            u003cu003e9_12 = (Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute o) => o.get_Value();
                            OrphanGroupProcessor.< > c.< > 9__1_2 = u003cu003e9_12;
                        }
                        strs.AddRange(values.Select <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute, string>(u003cu003e9_12));
                    });
                    ServicesUserServiceClient serviceUser = new ServicesUserServiceClient(false);
                    List <User> owners = serviceUser.Get(Helper.CurrentTask.get_IdentityStoreId(), strs1, new List <string>());
                    addOwnersLookup = owners.ToLookup <User, string>((User o) => o.get_ObjectIdFromIdentityStore(), StringComparer.OrdinalIgnoreCase);
                }
            }
            List <IdentityStoreObject> orphansList = new List <IdentityStoreObject>();

            foreach (IdentityStoreObject oGrp in orphanGrps)
            {
                if (oGrp.get_AttributesBusinessObject().IsIn(Helper.KnownProviderAttributes.get_Container()))
                {
                    oGrp.get_AttributesBusinessObject().Remove(Helper.KnownProviderAttributes.get_Container());
                }
                if (oGrp.get_AttributesBusinessObject().IsIn(Helper.KnownProviderAttributes.get_DisplayName()))
                {
                    oGrp.get_AttributesBusinessObject().Remove(Helper.KnownProviderAttributes.get_DisplayName());
                }
                if (oGrp.get_AttributesBusinessObject().IsIn(Helper.KnownProviderAttributes.get_DistinguishedName()))
                {
                    oGrp.get_AttributesBusinessObject().Remove(Helper.KnownProviderAttributes.get_DistinguishedName());
                }
                if (oGrp.get_AttributesBusinessObject().IsIn(Helper.KnownProviderAttributes.get_CommonName()))
                {
                    oGrp.get_AttributesBusinessObject().Remove(Helper.KnownProviderAttributes.get_CommonName());
                }
                Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute additionalOwner = this.GetAdditionalOwnerToPromote(oGrp.get_AttributesBusinessObject().GetValues("XAdditionalOwner"), addOwnersLookup, supportedObjectTypes);
                if (additionalOwner != null)
                {
                    ServicesUserServiceClient serviceUser = new ServicesUserServiceClient(false);
                    User additionaOwnerDN = serviceUser.Get(Helper.CurrentTask.get_IdentityStoreId(), additionalOwner.get_Value(), new List <string>()
                    {
                        Helper.KnownProviderAttributes.get_DistinguishedName(),
                        Helper.KnownProviderAttributes.get_EmailAddress(),
                        Helper.KnownProviderAttributes.get_DisplayName()
                    }, false);
                    if ((additionaOwnerDN == null ? false : additionaOwnerDN.get_AttributesBusinessObject().HasValue(Helper.KnownProviderAttributes.get_DistinguishedName())))
                    {
                        oGrp.set_ObjectName(additionalOwner.get_Value());
                        ownerUsers.Add(additionaOwnerDN);
                        additionaOwnerDN.set_ObjectIdFromIdentityStore(additionalOwner.get_Value());
                        additionalOwner.set_Action(2);
                        string dnValue = additionaOwnerDN.get_AttributesBusinessObject().get_AttributesCollection()[Helper.KnownProviderAttributes.get_DistinguishedName()][0].get_Value();
                        if (oGrp.get_AttributesBusinessObject().HasValue(Helper.KnownProviderAttributes.get_Owner()))
                        {
                            oGrp.get_AttributesBusinessObject().get_AttributesCollection()[Helper.KnownProviderAttributes.get_Owner()][0].set_Value(dnValue);
                            oGrp.get_AttributesBusinessObject().get_AttributesCollection()[Helper.KnownProviderAttributes.get_Owner()][0].set_Action(1);
                        }
                        else if (!oGrp.get_AttributesBusinessObject().IsIn(Helper.KnownProviderAttributes.get_Owner()))
                        {
                            Dictionary <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > attributesCollection = oGrp.get_AttributesBusinessObject().get_AttributesCollection();
                            string owner = Helper.KnownProviderAttributes.get_Owner();
                            List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> attributes = new List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute>();
                            Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute        attribute  = new Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute();
                            attribute.set_Action(1);
                            attribute.set_Value(dnValue);
                            attributes.Add(attribute);
                            attributesCollection.Add(owner, attributes);
                        }
                        else
                        {
                            Dictionary <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > attributesCollection1 = oGrp.get_AttributesBusinessObject().get_AttributesCollection();
                            string str = Helper.KnownProviderAttributes.get_Owner();
                            List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> attributes1 = new List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute>();
                            Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute        attribute1  = new Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute();
                            attribute1.set_Action(1);
                            attribute1.set_Value(dnValue);
                            attributes1.Add(attribute1);
                            attributesCollection1[str] = attributes1;
                        }
                        orphansList.Add(oGrp);
                    }
                }
            }
            if (orphansList.Count > 0)
            {
                ServicesGroupServiceClient groupServiceClient = new ServicesGroupServiceClient(false);
                string cData = DataCompressionHelper.CompressObjects <List <IdentityStoreObject> >(orphansList);
                if (groupServiceClient.UpdateManyWithCompression(Helper.CurrentTask.get_IdentityStoreId(), cData, typeof(IdentityStoreObject).FullName).get_Status() == 0)
                {
                    List <IdentityStoreObject> idObjectsList = Helper.PrepareCompressedData(orphansList);
                    groupServiceClient.SendOwnerUpdateNotification(Helper.CurrentTask.get_IdentityStoreId(), idObjectsList, ownerUsers);
                }
            }
        }