Exemplo n.º 1
0
 /// <summary>
 /// Construct a new instance of DatabaseTimerJob
 /// </summary>
 /// <param name="jobName">Time job name</param>
 /// <param name="repository">db repository</param>
 /// <param name="url">tenant url</param>
 /// <param name="pageSize">Page size for database query result retreival, defaults to 500</param>
 public DatabaseTimerJob(string jobName, GovernanceDbRepository repository, string url, int pageSize = 500)
     : base(jobName, repository)
 {
     AddSite(url);
     TenantUrl = url;
     PageSize = pageSize;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // Disbale useTheading when debuging
            bool useThreading = 
#if DEBUG
                false;
#else
                true;
#endif
            // Init site information DB repository
            string connectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
            var dbRepository = new GovernanceDbRepository(connectionString);

            // Step thru each SharePoint site collection,
            // synchronize the latest status to site information DB
            var syncJob = new SynchronizationJob(dbRepository, TenantUrl);
            syncJob.UseThreading = useThreading;
            syncJob.SetEnumerationCredentials(User, Password);
            syncJob.UseAppOnlyAuthentication(ClientId, ClientSecret);
            syncJob.Run();

            // Step thru each site information DB record,
            // delete all out-dated ones, of which the related SharePoint site collection has been deleted
            var cleanupJob = new CleanUpJob(dbRepository, TenantUrl);
            cleanupJob.UseThreading = useThreading;
            cleanupJob.SetEnumerationCredentials(User, Password);
            cleanupJob.UseAppOnlyAuthentication(ClientId, ClientSecret);
            cleanupJob.Run();

            // Detect broadly accessible HBI webs and log large security group information in DB repository
            var hbiBroadAccessJob = new GovernancePreprocessJob(dbRepository, TenantUrl, new HbiBroadAccessPolicy());
            hbiBroadAccessJob.UseThreading = useThreading;
            hbiBroadAccessJob.SetEnumerationCredentials(User, Password);
            hbiBroadAccessJob.UseAppOnlyAuthentication(ClientId, ClientSecret);
            hbiBroadAccessJob.Run();

            // Query all incomlpiant site information records based on the governance policies checking logic (defined in ISitePolicy.NoncompliancePredictor),
            // then run the enforcement logic for each site.
            var governanceJob = new GovernanceJob(dbRepository, TenantUrl);
            governanceJob.UseThreading = useThreading;
            governanceJob.SetEnumerationCredentials(User, Password);
            governanceJob.UseAppOnlyAuthentication(ClientId, ClientSecret);
            governanceJob.Run();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Construct a new instance of GovernancePreprocessJob
 /// </summary>
 /// <param name="repository">The db repository</param>
 /// <param name="url">The tenant URL</param>
 /// <param name="policy">The complex site policy which requires preprocess</param>
 public GovernancePreprocessJob(GovernanceDbRepository repository, string url, ISitePolicy policy)
     : base("GovernancePreprocessJob", repository, url)
 {
     Policy = policy;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Construct a new instance of TenantManagementTimerJob
 /// </summary>
 /// <param name="jobName">Time job name</param>
 /// <param name="dbRepository">The db repository</param>
 public TenantManagementTimerJob(string jobName, GovernanceDbRepository dbRepository)
     : base(jobName)
 {
     TimerJobRun += ManagementTimerJob_TimerJobRun;
     DbRepository = dbRepository;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Construct a new instance of GovernanceJob
 /// </summary>
 /// <param name="repository">db repository</param>
 /// <param name="url">tenant url</param>
 public GovernanceJob(GovernanceDbRepository repository, string url)
     : base("GovernanceJob", repository, url)
 {
     Includes = new string[] { "Administrators", "SiteMetadata" };
     PolicyManager = new SitePolicyManager();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initialize a new instance of SynchronizationJob object
 /// </summary>
 /// /// <param name="repository">The governance database repository to be synchronized with SPO tenant</param>        
 /// <param name="url">The tenant url, like https://contoso.microsoft.com</param>
 public SynchronizationJob(GovernanceDbRepository repository, string url)
     : base("SynchronizationJob", repository)
 {
     AddSite(string.Format("{0}/*", url.TrimEnd("/".ToCharArray())));
 }
Exemplo n.º 7
0
 static RemediationController()
 {
     string connectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
     DbRepository = new GovernanceDbRepository(connectionString);
 }
Exemplo n.º 8
0
 public CleanUpJob(GovernanceDbRepository repository, string url)
      : base("CleanUpJob", repository, url)
  {
  }