Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 29987f1f
authored
Mar 29, 2015
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check permissions for rest api ops
1 parent
8c0322bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/UserBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/UserBeanLocal.java
View file @
29987f1
...
...
@@ -159,7 +159,7 @@ public interface UserBeanLocal {
* </ul>
*
* @param source
* @param dst
* @param dst
Eventuser
* @return Saldo transferred. Zero if no transfer was made, Null if there
* was error..
*/
...
...
@@ -181,9 +181,9 @@ public interface UserBeanLocal {
/**
* Check that user's password matches.
* @param
userId
* @param
eventUser
* @param password
* @return true if matches, false if does not, null if user not found.
*/
Boolean
checkPassword
(
Integer
userId
,
String
password
);
Boolean
checkPassword
(
EventUser
eventUser
,
String
password
);
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
29987f1
...
...
@@ -464,8 +464,12 @@ public class UserBean implements UserBeanLocal {
}
@Override
@RolesAllowed
(
UserPermission
.
S_MODIFY
)
public
boolean
resetPassword
(
User
user
,
String
password
)
{
return
false
;
logger
.
debug
(
"Changing user {} password"
,
user
);
user
.
resetPassword
(
password
);
userFacade
.
merge
(
user
);
return
true
;
}
@Override
...
...
@@ -1116,10 +1120,10 @@ public class UserBean implements UserBeanLocal {
}
@Override
public
Boolean
checkPassword
(
Integer
userId
,
String
password
)
{
User
user
=
userFacade
.
find
(
userId
);
if
(
u
ser
!=
null
)
{
return
u
ser
.
checkPassword
(
password
);
@RolesAllowed
(
UserPermission
.
S_VIEW_ALL
)
public
Boolean
checkPassword
(
EventUser
eventUser
,
String
password
)
{
if
(
eventU
ser
!=
null
)
{
return
eventU
ser
.
checkPassword
(
password
);
}
return
null
;
}
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/UserRestView.java
View file @
29987f1
...
...
@@ -321,7 +321,8 @@ public class UserRestView {
return
Response
.
status
(
Status
.
NOT_FOUND
).
build
();
}
boolean
passwordOk
=
user
.
checkPassword
(
password
);
//boolean passwordOk = user.checkPassword(password);
boolean
passwordOk
=
userbean
.
checkPassword
(
user
,
password
);
if
(
passwordOk
)
{
return
Response
.
ok
(
PojoUtils
.
initEventUserRestPojo
(
user
),
MediaType
.
APPLICATION_JSON_TYPE
).
build
();
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment