예제 #1
0
        private void ConfigureOptions()
        {
            IAccessControl accessControl = (IAccessControl)Environment.Host.ApplicationBuilder.ApplicationServices.GetService(typeof(IAccessControl));
            IFileProvider  fileProvider  = (IFileProvider)Environment.Host.ApplicationBuilder.ApplicationServices.GetService(typeof(IFileProvider));

            string inetpubPath          = System.Environment.ExpandEnvironmentVariables(@"%SystemDrive%\inetpub");
            IEnumerable <string> claims = accessControl.GetClaims(inetpubPath);

            if (claims == null)
            {
                //
                // Only add default inetpub access if no access rights have been specified

                fileProvider.Options.AddLocation(new Location()
                {
                    Alias  = "inetpub",
                    Path   = inetpubPath,
                    Claims = new List <string> {
                        "read"
                    }
                });
            }
        }
 public IEnumerable <string> GetClaims(string path)
 {
     return(_accessControl.GetClaims(path));
 }