Merge branch 'develop' into feature/mobile-main-button

This commit is contained in:
Dmitry Sychugov 2021-11-19 14:35:39 +05:00
commit 0e52607238
11 changed files with 110 additions and 39 deletions

View File

@ -1,6 +1,7 @@
@echo off
PUSHD %~dp0..
dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
@echo off
echo.
echo Install nodejs projects dependencies...
echo.
@ -15,6 +16,8 @@ if %errorlevel% == 0 (
echo.
POPD
if "%1"=="nopause" goto start
pause
:start

View File

@ -1,18 +1,27 @@
@echo off
echo "##########################################################"
echo "######### Start build and deploy #######################"
echo "##########################################################"
echo.
PUSHD %~dp0
call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 (
call start\stop.bat
PUSHD %~dp0..
call start\stop.bat nopause
echo "FRONT-END (for start run command 'yarn start' inside the root folder)"
call build\build.frontend.bat
call build.frontend.bat nopause
echo "BACK-END"
call build\build.backend.bat
call build.backend.bat nopause
start /b call build\start\start.bat
call start\start.bat nopause
echo.
pause
)

View File

@ -48,15 +48,24 @@ powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-studio.conf
REM restart nginx
echo service nginx stop
call sc stop nginx
call sc stop nginx > nul
REM sleep 5 seconds
call ping 127.0.0.1 -n 6 > nul
echo service nginx start
call sc start nginx
call sc start nginx > nul
if NOT %errorlevel% == 0 (
echo Couldn't restarte Onlyoffice%%~nf service
)
)
echo.
POPD
if "%1"=="nopause" goto start
pause
:start

View File

@ -1,3 +1,9 @@
echo "##########################################################"
echo "######### Start build and deploy Personal ##############"
echo "##########################################################"
echo.
PUSHD %~dp0
call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 (

View File

@ -1,5 +1,11 @@
@echo off
PUSHD %~dp0
echo "##########################################################"
echo "######### Start build and deploy #######################"
echo "##########################################################"
echo.
setlocal EnableDelayedExpansion
call runasadmin.bat "%~dpnx0"
@ -8,15 +14,15 @@ if %errorlevel% == 0 (
call start\stop.bat nopause
PUSHD %~dp0..
echo "FRONT-END static"
call build\build.static.bat nopause
call build.static.bat nopause
echo "BACK-END"
call build\build.backend.bat nopause
call build.backend.bat nopause
call build\start\start.bat nopause
call start\start.bat nopause
echo.
pause
)

View File

@ -23,6 +23,5 @@ if '%errorlevel%' NEQ '0' (
exit /B 1
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------

33
build/start/command.ps1 Normal file
View File

@ -0,0 +1,33 @@
$PSversionMajor = $PSVersionTable.PSVersion | sort-object major | ForEach-Object {$_.major}
$PSversionMinor = $PSVersionTable.PSVersion | sort-object minor | ForEach-Object {$_.minor}
if ($PSversionMajor -lt 7 -or $PSversionMinor -lt 2) {
Write-Error "Powershell version must be greater than or equal to 7.2. Press Enter to exit."
Pause
exit
}
$WorkDir = "$(Split-Path -Parent $PSScriptRoot)\run";
$CommandName = "$($args[0])";
#Write-Output "Starting $($CommandName) services at time: $(Get-Date -Format HH:mm:ss)"
#Write-Output ""
Get-ChildItem -Path $WorkDir | ForEach-Object -ThrottleLimit 20 -Parallel {
$ServiceName = "Onlyoffice$([System.IO.Path]::GetFileNameWithoutExtension($_))";
switch ( $Using:CommandName )
{
"start" { Start-Service -InputObject $(Get-Service -Name "$ServiceName") }
"stop" { Stop-Service -InputObject $(Get-Service -Name "$ServiceName") }
"restart" { Restart-Service -InputObject $(Get-Service -Name "$ServiceName") }
}
if( $? )
{
Write-Output "$ServiceName $($Using:CommandName) service has been done"
}
}
#Write-Output ""
#Write-Output "End $($CommandName) services at time: $(Get-Date -Format HH:mm:ss)"

View File

@ -3,11 +3,10 @@
PUSHD %~dp0..
call runasadmin.bat "%~dpnx0"
POPD
if %errorlevel% == 0 (
for /R "run\" %%f in (*.bat) do (
call sc stop "Onlyoffice%%~nf"
call sc start "Onlyoffice%%~nf"
)
pwsh %~dp0/command.ps1 "restart"
)
echo.

View File

@ -3,10 +3,10 @@
PUSHD %~dp0..
call runasadmin.bat "%~dpnx0"
POPD
if %errorlevel% == 0 (
for /R "run\" %%f in (*.bat) do (
call sc start "Onlyoffice%%~nf"
)
pwsh %~dp0/command.ps1 "start"
)
echo.

View File

@ -3,10 +3,10 @@
PUSHD %~dp0..
call runasadmin.bat "%~dpnx0"
POPD
if %errorlevel% == 0 (
for /R "run\" %%f in (*.bat) do (
call sc stop "Onlyoffice%%~nf"
)
pwsh %~dp0/command.ps1 "stop"
)
echo.

View File

@ -205,7 +205,8 @@ namespace ASC.Files.Core.Security
private IEnumerable<Guid> WhoCan<T>(FileEntry<T> entry, FilesSecurityActions action)
{
var shares = GetShares(entry);
var copyshares = GetShares(entry);
IEnumerable<FileShareRecord> shares = copyshares.ToList();
FileShareRecord defaultShareRecord;
@ -318,7 +319,7 @@ namespace ASC.Files.Core.Security
return new[] { x.Subject };
})
.Distinct()
.Where(x => Can(entry, x, action))
.Where(x => Can(entry, x, action, copyshares))
.ToList();
}
@ -342,9 +343,9 @@ namespace ASC.Files.Core.Security
return Filter(entries.Cast<FileEntry<T>>(), FilesSecurityActions.Edit, AuthContext.CurrentAccount.ID).Cast<Folder<T>>();
}
private bool Can<T>(FileEntry<T> entry, Guid userId, FilesSecurityActions action)
private bool Can<T>(FileEntry<T> entry, Guid userId, FilesSecurityActions action, IEnumerable<FileShareRecord> shares = null)
{
return Filter(new[] { entry }, action, userId).Any();
return Filter(new[] { entry }, action, userId, shares).Any();
}
private List<Tuple<FileEntry<T>, bool>> Can<T>(IEnumerable<FileEntry<T>> entry, Guid userId, FilesSecurityActions action)
@ -353,7 +354,7 @@ namespace ASC.Files.Core.Security
return entry.Select(r => new Tuple<FileEntry<T>, bool>(r, filtres.Any(a => a.ID.Equals(r.ID)))).ToList();
}
private IEnumerable<FileEntry<T>> Filter<T>(IEnumerable<FileEntry<T>> entries, FilesSecurityActions action, Guid userId)
private IEnumerable<FileEntry<T>> Filter<T>(IEnumerable<FileEntry<T>> entries, FilesSecurityActions action, Guid userId, IEnumerable<FileShareRecord> shares = null)
{
if (entries == null || !entries.Any()) return Enumerable.Empty<FileEntry<T>>();
@ -383,8 +384,7 @@ namespace ASC.Files.Core.Security
if (entries.Any(filter))
{
var subjects = GetUserSubjects(userId);
List<FileShareRecord> shares = null;
List<Guid> subjects = null;
foreach (var e in entries.Where(filter))
{
if (!AuthManager.GetAccountByID(TenantManager.GetCurrentTenant().TenantId, userId).IsAuthenticated && userId != FileConstant.ShareLinkId)
@ -516,10 +516,17 @@ namespace ASC.Files.Core.Security
continue;
}
if (shares == null)
if (subjects == null)
{
shares = GetShares(entries).Join(subjects, r => r.Subject, s => s, (r, s) => r).ToList();
// shares ordered by level
subjects = GetUserSubjects(userId);
if (shares == null)
{
shares = GetShares(entries);
// shares ordered by level
}
shares = shares
.Join(subjects, r => r.Subject, s => s, (r, s) => r)
.ToList();
}
FileShareRecord ace;
@ -705,7 +712,7 @@ namespace ASC.Files.Core.Security
var records = securityDao.GetShares(subjects);
var result = new List<FileEntry>();
result.AddRange(GetSharesForMe<int>(records.Where(r=> r.EntryId.GetType() == typeof(int)), subjects, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders));
result.AddRange(GetSharesForMe<int>(records.Where(r => r.EntryId.GetType() == typeof(int)), subjects, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders));
result.AddRange(GetSharesForMe<string>(records.Where(r => r.EntryId.GetType() == typeof(string)), subjects, filterType, subjectGroup, subjectID, searchText, searchInContent, withSubfolders));
return result;
}