Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
f2b9e880
Commit
f2b9e880
authored
Jul 31, 2015
by
michael.simon
Browse files
Load groups recursive for user
parent
c11db231
Changes
3
Hide whitespace changes
Inline
Side-by-side
bwreg-service/src/main/java/edu/kit/scc/webreg/service/GroupService.java
View file @
f2b9e880
...
...
@@ -32,4 +32,6 @@ public interface GroupService extends BaseService<GroupEntity, Long> {
void
removeUserGromGroup
(
UserEntity
user
,
GroupEntity
group
);
Set
<
GroupEntity
>
findByUserWithParents
(
UserEntity
user
);
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/GroupServiceImpl.java
View file @
f2b9e880
...
...
@@ -85,6 +85,23 @@ public class GroupServiceImpl extends BaseServiceImpl<GroupEntity, Long> impleme
return
groupDao
.
findByUser
(
user
);
}
@Override
public
Set
<
GroupEntity
>
findByUserWithParents
(
UserEntity
user
)
{
Set
<
GroupEntity
>
groups
=
new
HashSet
<
GroupEntity
>(
groupDao
.
findByUser
(
user
));
Set
<
GroupEntity
>
targetGroups
=
new
HashSet
<
GroupEntity
>();
rollParents
(
targetGroups
,
groups
,
0
,
3
);
return
groups
;
}
private
void
rollParents
(
Set
<
GroupEntity
>
targetGroups
,
Set
<
GroupEntity
>
groups
,
int
depth
,
int
maxDepth
)
{
if
(
depth
<=
maxDepth
)
{
for
(
GroupEntity
group
:
groups
)
{
rollParents
(
targetGroups
,
group
.
getParents
(),
depth
+
1
,
maxDepth
);
targetGroups
.
add
(
group
);
}
}
}
@Override
protected
BaseDao
<
GroupEntity
,
Long
>
getDao
()
{
return
groupDao
;
...
...
bwreg-webapp/src/main/java/edu/kit/scc/webreg/sec/AuthorizationBean.java
View file @
f2b9e880
...
...
@@ -93,7 +93,8 @@ public class AuthorizationBean implements Serializable {
if
(
sessionManager
.
getRoleSetCreated
()
==
null
||
(
System
.
currentTimeMillis
()
-
sessionManager
.
getRoleSetCreated
())
>
5
*
60
*
1000L
)
{
start
=
System
.
currentTimeMillis
();
List
<
GroupEntity
>
groupList
=
groupService
.
findByUser
(
user
);
Set
<
GroupEntity
>
groupList
=
groupService
.
findByUserWithParents
(
user
);
sessionManager
.
setGroupString
(
groupsToString
(
groupList
));
for
(
GroupEntity
g
:
groupList
)
{
...
...
@@ -267,9 +268,9 @@ public class AuthorizationBean implements Serializable {
return
unregisteredServiceList
;
}
private
String
groupsToString
(
Lis
t
<
GroupEntity
>
group
List
)
{
private
String
groupsToString
(
Se
t
<
GroupEntity
>
group
s
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
GroupEntity
group
:
group
List
)
{
for
(
GroupEntity
group
:
group
s
)
{
if
(
group
instanceof
HomeOrgGroupEntity
&&
((
HomeOrgGroupEntity
)
group
).
getPrefix
()
!=
null
)
{
sb
.
append
(((
HomeOrgGroupEntity
)
group
).
getPrefix
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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