Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
reg-app
Regapp
Commits
59c20f76
Commit
59c20f76
authored
Jan 26, 2021
by
michael.simon
Browse files
Add attribute-query interface with uidNumber
parent
b6a6059d
Changes
3
Hide whitespace changes
Inline
Side-by-side
bwreg-service/src/main/java/edu/kit/scc/webreg/service/UserUpdateService.java
View file @
59c20f76
...
...
@@ -19,5 +19,8 @@ public interface UserUpdateService {
void
updateUserAsync
(
String
eppn
,
String
localHostName
,
String
executor
);
Map
<
String
,
String
>
updateUser
(
Long
uidNumber
,
String
serviceShortName
,
String
localHostName
,
String
executor
)
throws
IOException
,
RestInterfaceException
;
}
bwreg-service/src/main/java/edu/kit/scc/webreg/service/impl/UserUpdateServiceImpl.java
View file @
59c20f76
...
...
@@ -62,6 +62,26 @@ public class UserUpdateServiceImpl implements UserUpdateService, Serializable {
@Inject
private
ApplicationConfig
appConfig
;
@Override
public
Map
<
String
,
String
>
updateUser
(
Long
uidNumber
,
String
serviceShortName
,
String
localHostName
,
String
executor
)
throws
IOException
,
RestInterfaceException
{
UserEntity
user
=
findUser
(
uidNumber
);
if
(
user
==
null
)
throw
new
NoUserFoundException
(
"no such user"
);
ServiceEntity
service
=
findService
(
serviceShortName
);
if
(
service
==
null
)
throw
new
NoServiceFoundException
(
"no such service"
);
RegistryEntity
registry
=
findRegistry
(
user
,
service
);
if
(
registry
==
null
)
throw
new
NoRegistryFoundException
(
"user not registered for service"
);
return
update
(
user
,
service
,
registry
,
localHostName
,
executor
);
}
@Override
public
Map
<
String
,
String
>
updateUser
(
String
eppn
,
String
serviceShortName
,
String
localHostName
,
String
executor
)
...
...
@@ -278,4 +298,14 @@ public class UserUpdateServiceImpl implements UserUpdateService, Serializable {
return
user
;
}
private
UserEntity
findUser
(
Long
uidNumber
)
{
UserEntity
user
=
userDao
.
findByUidNumber
(
uidNumber
);
if
(
user
!=
null
)
{
user
=
userDao
.
findByIdWithStore
(
user
.
getId
());
}
return
user
;
}
}
bwreg-webapp/src/main/java/edu/kit/scc/webreg/rest/AttributeQueryController.java
View file @
59c20f76
...
...
@@ -63,6 +63,15 @@ public class AttributeQueryController {
return
userUpdateService
.
updateUser
(
eppn
,
serviceShortName
,
request
.
getLocalName
(),
"rest-/attrq/eppn/"
+
serviceShortName
+
"/"
+
eppn
);
}
@GET
@Path
(
"/uid-number/{service}/{uidNumber}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
public
Map
<
String
,
String
>
attributeQueryUidNumber
(
@PathParam
(
"uidNumber"
)
Long
uidNumber
,
@PathParam
(
"service"
)
String
serviceShortName
,
@Context
HttpServletRequest
request
)
throws
IOException
,
ServletException
,
RestInterfaceException
{
return
userUpdateService
.
updateUser
(
uidNumber
,
serviceShortName
,
request
.
getLocalName
(),
"rest-/attrq/uid-number/"
+
serviceShortName
+
"/"
+
uidNumber
);
}
@GET
@Path
(
"/regid/{regid}"
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
...
...
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