Exemple #1
0
        public async Task <FileAccessor> Create(string path, IPrincipal currentUser)
        {
            var temp = GetTypeAndProperty(path);

            var result = new FileAccessor(temp.Type, temp.PropertyInfo, temp.Id, currentUser, Database);

            await result.LoadBlob();

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new SecureFileAccessor instance.
        /// </summary>
        public static async Task <FileAccessor> Create(string path, IPrincipal currentUser)
        {
            var result = new FileAccessor
            {
                CurrentUser = currentUser,
                PathParts   = path.Split('/')
            };

            if (result.PathParts.Length < 2)
            {
                throw new Exception($"Invalid path specified: '{path}'");
            }

            result.FindRequestedProperty();

            await result.FindRequestedObject();

            result.SecurityErrors = result.GetSecurityErrors();

            return(result);
        }