public async Task <string> ListUsersWithAccess(string path)
        {
            var userName = await GetLoggedUserName();

            var usersWithAccess = _resourceAccessService.ListUserWithAccessToResource(userName, path);

            return(String.Join(';', usersWithAccess));
        }
Exemplo n.º 2
0
        public async Task <byte[]> DownloadFile(string userName, string ownerName, string filePath)
        {
            var usersWithAccess = _resourceAccessService.ListUserWithAccessToResource(ownerName, filePath);

            if (!usersWithAccess.Contains(userName))
            {
                throw new MiniCloudException("User doesn't have access to resource");
            }
            string fileServerPath = PathUtilities.GenerateFullPath(ownerName, filePath);

            if (!File.Exists(fileServerPath))
            {
                throw new MiniCloudException("File doesn't exists");
            }
            var fileBytes = await File.ReadAllBytesAsync(fileServerPath);;

            return(fileBytes);
        }