Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
c5cac29e
Commit
c5cac29e
authored
Dec 26, 2025
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openDocument.js - доработка проверки прав при открытии документа
parent
f6cd1205
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
9 deletions
+44
-9
constructor/scripts/openDocument/openDocument.js
constructor/scripts/openDocument/openDocument.js
+44
-9
No files found.
constructor/scripts/openDocument/openDocument.js
View file @
c5cac29e
...
@@ -52,6 +52,23 @@ const getRegistryRoute = async registryID => {
...
@@ -52,6 +52,23 @@ const getRegistryRoute = async registryID => {
});
});
}
}
const
canEditFile
=
async
(
documentID
)
=>
{
return
new
Promise
(
async
resolve
=>
{
try
{
const
{
login
,
password
}
=
Cons
.
creds
;
const
auth
=
"
Basic
"
+
btoa
(
unescape
(
encodeURIComponent
(
`
${
login
}
:
${
password
}
`
)));
const
url
=
`../Synergy/rest/api/storage/canEditFile?documentId=
${
documentID
}
`
;
const
response
=
await
fetch
(
url
,
{
method
:
'
GET
'
,
headers
:
{
"
Authorization
"
:
auth
}});
if
(
!
response
.
ok
)
throw
new
Error
(
await
response
.
text
());
resolve
(
response
.
text
());
}
catch
(
err
)
{
console
.
log
(
`ERROR [ canEditFile ]:
${
err
.
message
}
`
);
resolve
(
false
);
}
});
}
const
getFileModels
=
player
=>
{
const
getFileModels
=
player
=>
{
const
result
=
[];
const
result
=
[];
player
.
model
.
models
[
0
].
modelBlocks
[
0
].
forEach
(
block
=>
{
player
.
model
.
models
[
0
].
modelBlocks
[
0
].
forEach
(
block
=>
{
...
@@ -1971,6 +1988,23 @@ class ARMFooter {
...
@@ -1971,6 +1988,23 @@ class ARMFooter {
this
.
init
();
this
.
init
();
}
}
canEditDoc
(
_doc
){
let
canEdit
=
true
;
if
(
_doc
.
dataUUID
)
{
if
(
!
_doc
.
hasOwnProperty
(
'
registryInfo
'
))
{
canEdit
=
false
;
}
else
{
if
(
_doc
.
registryInfo
.
hasOwnProperty
(
'
rights
'
)
&&
_doc
.
registryInfo
.
rights
==
"
no
"
)
{
canEdit
=
false
;
}
else
if
(
_doc
.
registryInfo
.
rr_read
!=
"
Y
"
)
{
canEdit
=
false
;
}
}
}
if
(
_doc
.
canEdit
==
"
true
"
)
_doc
.
canEdit
=
true
;
return
canEdit
||
_doc
.
canEdit
;
}
async
initParams
(
_doc
){
async
initParams
(
_doc
){
Cons
.
showLoader
();
Cons
.
showLoader
();
try
{
try
{
...
@@ -1989,6 +2023,7 @@ class ARMFooter {
...
@@ -1989,6 +2023,7 @@ class ARMFooter {
_doc
.
process
=
await
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
`rest/api/workflow/get_execution_process?documentID=
${
_doc
.
documentID
}
&locale=
${
AS
.
OPTIONS
.
locale
}
`
);
_doc
.
process
=
await
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
`rest/api/workflow/get_execution_process?documentID=
${
_doc
.
documentID
}
&locale=
${
AS
.
OPTIONS
.
locale
}
`
);
_doc
.
processResponsible
=
getResponsibleUserWork
(
_doc
.
process
);
_doc
.
processResponsible
=
getResponsibleUserWork
(
_doc
.
process
);
_doc
.
process
=
getUserWork
(
_doc
.
process
,
AS
.
OPTIONS
.
currentUser
.
userid
);
_doc
.
process
=
getUserWork
(
_doc
.
process
,
AS
.
OPTIONS
.
currentUser
.
userid
);
if
(
_doc
.
type
==
'
document
'
)
{
if
(
_doc
.
type
==
'
document
'
)
{
if
(
_doc
.
process
.
length
)
{
if
(
_doc
.
process
.
length
)
{
...
@@ -2018,21 +2053,21 @@ class ARMFooter {
...
@@ -2018,21 +2053,21 @@ class ARMFooter {
if
(
_doc
.
dataUUID
)
{
if
(
_doc
.
dataUUID
)
{
_doc
.
registryInfo
=
await
appAPI
.
getRegistryInfoByID
(
_doc
.
docInfo
.
registryID
);
_doc
.
registryInfo
=
await
appAPI
.
getRegistryInfoByID
(
_doc
.
docInfo
.
registryID
);
_doc
.
registryInfo
=
await
appAPI
.
getRegistryInfoByID
(
_doc
.
docInfo
.
registryID
);
const
msgErrorRead
=
'
Вам запрещен доступ к этому документу
'
;
if
(
!
_doc
.
registryInfo
)
throw
new
Error
(
msgErrorRead
);
if
(
_doc
.
registryInfo
.
hasOwnProperty
(
'
rights
'
)
&&
_doc
.
registryInfo
.
rights
==
"
no
"
)
throw
new
Error
(
msgErrorRead
);
if
(
_doc
.
registryInfo
.
rr_read
!=
"
Y
"
)
throw
new
Error
(
msgErrorRead
);
_doc
.
form
=
await
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
`rest/api/asforms/form/
${
_doc
.
docInfo
.
formID
}
?locale=
${
AS
.
OPTIONS
.
locale
}
`
);
_doc
.
form
=
await
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
`rest/api/asforms/form/
${
_doc
.
docInfo
.
formID
}
?locale=
${
AS
.
OPTIONS
.
locale
}
`
);
_doc
.
canEdit
=
await
canEditFile
(
_doc
.
documentID
);
if
(
!
this
.
canEditDoc
(
_doc
))
throw
new
Error
(
'
Вам запрещен доступ к этому документу
'
);
_doc
.
formName
=
_doc
.
form
.
name
;
_doc
.
formName
=
_doc
.
form
.
name
;
_doc
.
registryCode
=
_doc
.
registryInfo
.
code
;
_doc
.
registryCode
=
_doc
?.
registryInfo
?
.
code
;
_doc
.
meaning
=
await
appAPI
.
getDocMeaningContent
(
_doc
.
dataUUID
);
_doc
.
meaning
=
await
appAPI
.
getDocMeaningContent
(
_doc
.
dataUUID
);
if
(
_doc
.
workInfo
)
_doc
.
workInfo
.
dataUUID
=
_doc
.
dataUUID
;
if
(
_doc
.
workInfo
)
_doc
.
workInfo
.
dataUUID
=
_doc
.
dataUUID
;
_doc
.
registryRoute
=
await
getRegistryRoute
(
_doc
.
registryInfo
.
registryID
);
_doc
.
registryRoute
=
null
;
if
(
_doc
.
hasOwnProperty
(
'
registryInfo
'
)
&&
_doc
.
registryInfo
.
hasOwnProperty
(
'
registryID
'
)
)
{
_doc
.
registryRoute
=
await
getRegistryRoute
(
_doc
.
registryInfo
.
registryID
);
}
_doc
.
formPlayer
=
AS
.
FORMS
.
createPlayer
();
_doc
.
formPlayer
=
AS
.
FORMS
.
createPlayer
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment