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
4ed845ff
Commit
4ed845ff
authored
Jul 22, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated javadoc
parent
e47c0f12
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
29 deletions
+46
-29
core/src/main/java/org/genesys/blocks/model/filters/UuidModelFilter.java
...ava/org/genesys/blocks/model/filters/UuidModelFilter.java
+3
-2
security/src/main/java/org/genesys/blocks/security/model/AclAwareModel.java
...java/org/genesys/blocks/security/model/AclAwareModel.java
+4
-2
security/src/main/java/org/genesys/blocks/security/persistence/AclObjectIdentityPersistence.java
...ks/security/persistence/AclObjectIdentityPersistence.java
+3
-3
security/src/main/java/org/genesys/blocks/security/service/BasicUserService.java
...org/genesys/blocks/security/service/BasicUserService.java
+5
-4
security/src/main/java/org/genesys/blocks/security/service/CustomAclService.java
...org/genesys/blocks/security/service/CustomAclService.java
+16
-15
security/src/main/java/org/genesys/blocks/security/service/impl/BasicUserServiceImpl.java
...ys/blocks/security/service/impl/BasicUserServiceImpl.java
+15
-3
No files found.
core/src/main/java/org/genesys/blocks/model/filters/UuidModelFilter.java
View file @
4ed845ff
/*
* Copyright 201
7
Global Crop Diversity Trust
* Copyright 201
8
Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -20,6 +20,7 @@ import java.util.UUID;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.genesys.blocks.model.QUuidModel
;
import
org.genesys.blocks.model.UuidModel
;
import
com.querydsl.core.BooleanBuilder
;
...
...
@@ -34,7 +35,7 @@ public class UuidModelFilter extends AuditedVersionedModelFilter {
/**
* Builds the query.
*
* @param
auditedVersionedModel the audited versione
d model
* @param
uuidModel the uui
d model
* @param builder the builder
*/
protected
void
buildQuery
(
final
QUuidModel
uuidModel
,
final
BooleanBuilder
builder
)
{
...
...
security/src/main/java/org/genesys/blocks/security/model/AclAwareModel.java
View file @
4ed845ff
/*
* Copyright 201
7
Global Crop Diversity Trust
* Copyright 201
8
Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -32,7 +32,9 @@ import org.genesys.blocks.util.JsonClassNameWriter;
public
interface
AclAwareModel
extends
Serializable
,
EntityId
{
/**
* Objects belonging to some parent can override this method
* Objects belonging to some parent can override this method.
*
* @return the parent ACL object (null by default)
*/
default
AclAwareModel
aclParentObject
()
{
return
null
;
...
...
security/src/main/java/org/genesys/blocks/security/persistence/AclObjectIdentityPersistence.java
View file @
4ed845ff
/*
* Copyright 201
7
Global Crop Diversity Trust
* Copyright 201
8
Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -39,8 +39,8 @@ public interface AclObjectIdentityPersistence extends JpaRepository<AclObjectIde
/**
* Clear the parentObject of child OID that use this oID as parentObject
*
* @param oID
*
* @param oID
the object identifier ID
*/
@Modifying
@Query
(
"update AclObjectIdentity aoi set aoi.parentObject = null where aoi.parentObject = ?1"
)
...
...
security/src/main/java/org/genesys/blocks/security/service/BasicUserService.java
View file @
4ed845ff
/*
* Copyright 201
7
Global Crop Diversity Trust
* Copyright 201
8
Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -36,6 +36,7 @@ import org.springframework.security.core.userdetails.UserDetailsService;
*/
public
interface
BasicUserService
<
R
extends
GrantedAuthority
,
T
extends
BasicUser
<
R
>>
extends
UserDetailsService
{
/** The system admin. */
public
String
SYSTEM_ADMIN
=
"SYSTEM_ADMIN"
;
/**
...
...
@@ -158,9 +159,9 @@ public interface BasicUserService<R extends GrantedAuthority, T extends BasicUse
T
setAccountType
(
T
user
,
AccountType
accountType
);
/**
* Update user's last login date
*
* @param userName
* Update user's last login date
.
*
* @param userName
the user name
* @throws NoUserFoundException if username not found in the system
*/
void
updateLastLogin
(
String
userName
)
throws
NoUserFoundException
;
...
...
security/src/main/java/org/genesys/blocks/security/service/CustomAclService.java
View file @
4ed845ff
...
...
@@ -40,15 +40,15 @@ public interface CustomAclService {
Permission
[]
getAvailablePermissions
(
String
className
);
/**
* Get SID by ID
*
* Get SID by ID
.
*
* @param id -- ID of an AclSid entity
* @return persisted AclSid entity with specified id
*/
AclSid
getSid
(
Long
id
);
/**
* Gets the sid of the specified authority
* Gets the sid of the specified authority
.
*
* @param authority the authority (must start with "ROLE_")
* @return the authority sid
...
...
@@ -84,15 +84,15 @@ public interface CustomAclService {
void
removePermissionsFor
(
AclSid
sid
);
/**
* Get object identity by internal id
*
* Get object identity by internal id
.
*
* @param id AclObjectIdentity id
* @return
* @return
the object identity
*/
AclObjectIdentity
getObjectIdentity
(
long
id
);
/**
* Gets the object identity for object of type className with specified id
* Gets the object identity for object of type className with specified id
.
*
* @param id the id
* @param className the clazz
...
...
@@ -101,7 +101,7 @@ public interface CustomAclService {
AclObjectIdentity
getObjectIdentity
(
long
id
,
String
className
);
/**
* Gets the object identity of the entity
* Gets the object identity of the entity
.
*
* @param entity the entity
* @return the object identity
...
...
@@ -138,8 +138,8 @@ public interface CustomAclService {
*
* @param entity the entity
* @param sid the sid
* @param permission
Map the permission map
* @return
* @param permission
s the permissions
* @return
the acl object identity
*/
AclObjectIdentity
setPermissions
(
AclAwareModel
entity
,
AclSid
sid
,
final
Permissions
permissions
);
...
...
@@ -148,8 +148,8 @@ public interface CustomAclService {
*
* @param objectIdentity the object identity
* @param sid the sid
* @param permission
Map the permission map
* @return
* @param permission
s the permissions
* @return
the acl object identity
*/
AclObjectIdentity
setPermissions
(
AclObjectIdentity
objectIdentity
,
AclSid
sid
,
final
Permissions
permissions
);
...
...
@@ -199,8 +199,8 @@ public interface CustomAclService {
List
<
Long
>
listObjectIdentityIdsForSid
(
Class
<?
extends
AclAwareModel
>
clazz
,
AclSid
sid
,
Permission
permission
);
/**
* Make entity publicly readable (or not)
*
* Make entity publicly readable (or not)
.
*
* @param aclAwareModel The entity
* @param publiclyReadable true or false?
* @since 1.4
...
...
@@ -208,7 +208,8 @@ public interface CustomAclService {
void
makePubliclyReadable
(
AclAwareModel
aclAwareModel
,
boolean
publiclyReadable
);
/**
* Cleanup ACL: remove {@link AclEntry} and {@link AclObjectIdentity} for missing ACL-aware entities, remove obsolete {@link AclClass}
* Cleanup ACL: remove {@link AclEntry} and {@link AclObjectIdentity} for
* missing ACL-aware entities, remove obsolete {@link AclClass}.
*/
void
cleanupAcl
();
}
security/src/main/java/org/genesys/blocks/security/service/impl/BasicUserServiceImpl.java
View file @
4ed845ff
...
...
@@ -74,6 +74,7 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
@Autowired
(
required
=
false
)
private
PasswordPolicy
passwordPolicy
;
/** The acl entry repository. */
@Autowired
(
required
=
false
)
protected
AclEntryPersistence
aclEntryRepository
;
...
...
@@ -97,15 +98,20 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
}
}
/**
* Gets the user repository.
*
* @return the user repository
*/
protected
abstract
JpaRepository
<
T
,
Long
>
getUserRepository
();
/**
* Implementations must create a user with specified username with ADMINISTRATOR
* role and account type {@link AccountType#SYSTEM}
*
* role and account type {@link AccountType#SYSTEM}
.
*
* @param username Generally SYSTEM_ADMIN
* @return user instance with ADMINISTRATOR role
* @throws UserException
* @throws UserException
the user exception
*/
protected
abstract
T
createSystemAdministrator
(
String
username
)
throws
UserException
;
...
...
@@ -164,6 +170,12 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
return
deepLoad
(
user
);
}
/**
* Deep load.
*
* @param user the user
* @return the t
*/
public
T
deepLoad
(
final
T
user
)
{
if
(
user
!=
null
)
{
user
.
getRoles
().
size
();
...
...
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