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); }
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>()); }
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); } } }
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); } }