Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
App Blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Genesys PGR
App Blocks
Commits
f5163f3f
Commit
f5163f3f
authored
Nov 12, 2018
by
Maxym Borodenko
Committed by
Matija Obreza
Nov 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend ACL service
- clear ACL cache
parent
a05c6557
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
security/src/main/java/org/genesys/blocks/security/service/CustomAclService.java
...org/genesys/blocks/security/service/CustomAclService.java
+16
-0
security/src/main/java/org/genesys/blocks/security/service/impl/CustomAclServiceImpl.java
...ys/blocks/security/service/impl/CustomAclServiceImpl.java
+46
-0
No files found.
security/src/main/java/org/genesys/blocks/security/service/CustomAclService.java
View file @
f5163f3f
...
...
@@ -69,6 +69,22 @@ public interface CustomAclService {
*/
void
createOrUpdatePermissions
(
AclAwareModel
entity
);
/**
* Updates inheriting status of object identity
*
* @param objectIdIdentity the id of object identity
* @param entriesInheriting the inheriting status
*/
AclObjectIdentity
updateInheriting
(
long
objectIdIdentity
,
boolean
entriesInheriting
);
/**
* Updates parent object of object identity
*
* @param objectIdIdentity the id of object identity
* @param parentObjectId the id of parent object identity
*/
AclObjectIdentity
updateParentObject
(
long
objectIdIdentity
,
long
parentObjectId
);
/**
* Removes the permissions on ACL model.
*
...
...
security/src/main/java/org/genesys/blocks/security/service/impl/CustomAclServiceImpl.java
View file @
f5163f3f
...
...
@@ -184,6 +184,52 @@ public class CustomAclServiceImpl implements CustomAclService {
}
}
@Override
@PreAuthorize
(
"hasRole('ADMINISTRATOR')"
)
public
AclObjectIdentity
updateInheriting
(
final
long
objectIdIdentity
,
final
boolean
entriesInheriting
)
{
final
AclObjectIdentity
objectIdentity
=
aclObjectIdentityPersistence
.
findOne
(
objectIdIdentity
);
if
(
objectIdentity
==
null
)
{
LOG
.
warn
(
"ACL object identity not found by id={}"
,
objectIdIdentity
);
return
null
;
}
if
(
objectIdentity
.
isEntriesInheriting
()
==
entriesInheriting
)
{
return
objectIdentity
;
}
else
{
try
{
LOG
.
info
(
"Updating inheriting status for OID={} to {}"
,
objectIdentity
,
entriesInheriting
);
objectIdentity
.
setEntriesInheriting
(
entriesInheriting
);
return
aclObjectIdentityPersistence
.
save
(
objectIdentity
);
}
finally
{
clearAclCache
();
}
}
}
@Override
@PreAuthorize
(
"hasRole('ADMINISTRATOR')"
)
public
AclObjectIdentity
updateParentObject
(
final
long
objectIdIdentity
,
final
long
parentObjectId
)
{
final
AclObjectIdentity
objectIdentity
=
aclObjectIdentityPersistence
.
findOne
(
objectIdIdentity
);
if
(
objectIdentity
==
null
)
{
LOG
.
warn
(
"ACL object identity not found by id={}"
,
objectIdIdentity
);
return
null
;
}
final
AclObjectIdentity
parentObject
=
aclObjectIdentityPersistence
.
findOne
(
parentObjectId
);
if
(
parentObject
==
null
)
{
LOG
.
warn
(
"ACL object identity not found by id={}"
,
objectIdIdentity
);
return
null
;
}
try
{
LOG
.
trace
(
"Updating ACL parent to {}"
,
parentObject
);
objectIdentity
.
setParentObject
(
parentObject
);
return
aclObjectIdentityPersistence
.
save
(
objectIdentity
);
}
finally
{
clearAclCache
();
}
}
/**
* Remove ACL data for AclAwareModel: deletes {@link AclObjectIdentity} and
* associated {@link AclEntry} list. If target happens to be {@link AclSid},
...
...
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