Esempio n. 1
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();
        }
Esempio 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();
        }