Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
John Samuel Ako Deutesfeld
ARSnova Backend
Commits
219bcea7
Commit
219bcea7
authored
7 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
Add methods to retrieve non-native users
parent
a2991fe5
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/services/UserService.java
+4
-0
4 additions, 0 deletions
src/main/java/de/thm/arsnova/services/UserService.java
src/main/java/de/thm/arsnova/services/UserServiceImpl.java
+11
-0
11 additions, 0 deletions
src/main/java/de/thm/arsnova/services/UserServiceImpl.java
with
15 additions
and
0 deletions
src/main/java/de/thm/arsnova/services/UserService.java
+
4
−
0
View file @
219bcea7
...
@@ -28,6 +28,8 @@ import java.util.UUID;
...
@@ -28,6 +28,8 @@ import java.util.UUID;
* The functionality the user service should provide.
* The functionality the user service should provide.
*/
*/
public
interface
UserService
{
public
interface
UserService
{
UserProfile
getCurrentUserProfile
();
UserAuthentication
getCurrentUser
();
UserAuthentication
getCurrentUser
();
boolean
isAdmin
(
String
username
);
boolean
isAdmin
(
String
username
);
...
@@ -58,6 +60,8 @@ public interface UserService {
...
@@ -58,6 +60,8 @@ public interface UserService {
int
loggedInUsers
();
int
loggedInUsers
();
UserProfile
getByAuthProviderAndLoginId
(
UserProfile
.
AuthProvider
authProvider
,
String
loginId
);
UserProfile
getByUsername
(
String
username
);
UserProfile
getByUsername
(
String
username
);
UserProfile
create
(
String
username
,
String
password
);
UserProfile
create
(
String
username
,
String
password
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/services/UserServiceImpl.java
+
11
−
0
View file @
219bcea7
...
@@ -179,6 +179,12 @@ public class UserServiceImpl implements UserService {
...
@@ -179,6 +179,12 @@ public class UserServiceImpl implements UserService {
userRepository
.
deleteInactiveUsers
(
lastActivityBefore
);
userRepository
.
deleteInactiveUsers
(
lastActivityBefore
);
}
}
@Override
public
UserProfile
getCurrentUserProfile
()
{
final
UserAuthentication
authentication
=
getCurrentUser
();
return
getByAuthProviderAndLoginId
(
authentication
.
getAuthProvider
(),
authentication
.
getUsername
());
}
@Override
@Override
public
UserAuthentication
getCurrentUser
()
{
public
UserAuthentication
getCurrentUser
()
{
final
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
final
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
...
@@ -355,6 +361,11 @@ public class UserServiceImpl implements UserService {
...
@@ -355,6 +361,11 @@ public class UserServiceImpl implements UserService {
return
userToRoomId
.
size
();
return
userToRoomId
.
size
();
}
}
@Override
public
UserProfile
getByAuthProviderAndLoginId
(
final
UserProfile
.
AuthProvider
authProvider
,
final
String
loginId
)
{
return
userRepository
.
findByAuthProviderAndLoginId
(
authProvider
,
loginId
);
}
@Override
@Override
public
UserProfile
getByUsername
(
String
username
)
{
public
UserProfile
getByUsername
(
String
username
)
{
return
userRepository
.
findByAuthProviderAndLoginId
(
UserProfile
.
AuthProvider
.
ARSNOVA
,
username
.
toLowerCase
());
return
userRepository
.
findByAuthProviderAndLoginId
(
UserProfile
.
AuthProvider
.
ARSNOVA
,
username
.
toLowerCase
());
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment