Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 9a98b30e
authored
Jan 10, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to permbean 'isCurrentUser' with 'login'
1 parent
3521c558
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PermissionBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PermissionBeanLocal.java
View file @
9a98b30
...
...
@@ -60,6 +60,8 @@ public interface PermissionBeanLocal {
boolean
hasPermission
(
SpecialPermission
superadmin
);
boolean
isCurrentUser
(
String
login
);
// boolean hasPermission(String perm);
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
View file @
9a98b30
...
...
@@ -156,7 +156,14 @@ public class PermissionBean implements PermissionBeanLocal {
@Override
public
boolean
isCurrentUser
(
User
user
)
{
return
(
context
.
getCallerPrincipal
()
==
null
||
user
==
null
)
?
false
:
context
.
getCallerPrincipal
().
getName
().
equals
(
user
.
getLogin
());
return
user
!=
null
&&
isCurrentUser
(
user
.
getLogin
());
}
@Override
public
boolean
isCurrentUser
(
String
login
)
{
return
(
context
.
getCallerPrincipal
()
==
null
||
login
==
null
)
?
false
:
context
.
getCallerPrincipal
().
getName
().
equals
(
login
);
}
@Override
...
...
@@ -215,7 +222,7 @@ public class PermissionBean implements PermissionBeanLocal {
//logger.debug("Principal: {}", principal);
String
principalName
=
principal
.
getName
();
// logger.debug("Principal is {}", principalName);
// logger.debug("Principal is {}", principalName);
return
principalName
;
}
...
...
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