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 000c6fe8
authored
Oct 21, 2013
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add special permission checking possibility to permissionbean
1 parent
0c5afbdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/PermissionBeanLocal.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
View file @
000c6fe
...
@@ -117,10 +117,17 @@ public class PermissionBean implements PermissionBeanLocal {
...
@@ -117,10 +117,17 @@ public class PermissionBean implements PermissionBeanLocal {
private
EventBeanLocal
eventbean
;
private
EventBeanLocal
eventbean
;
@Override
@Override
public
boolean
hasPermission
(
SpecialPermission
perm
)
{
if
(
perm
==
null
)
{
return
false
;
}
return
context
.
isCallerInRole
(
perm
.
toString
());
}
@Override
public
boolean
hasPermission
(
IAppPermission
perm
)
{
public
boolean
hasPermission
(
IAppPermission
perm
)
{
if
(
perm
==
null
)
if
(
perm
==
null
)
{
{
return
false
;
return
false
;
}
}
return
context
.
isCallerInRole
(
perm
.
getFullName
());
return
context
.
isCallerInRole
(
perm
.
getFullName
());
...
@@ -207,4 +214,5 @@ public class PermissionBean implements PermissionBeanLocal {
...
@@ -207,4 +214,5 @@ public class PermissionBean implements PermissionBeanLocal {
throw
new
IllegalStateException
(
"Current security principal has no CN"
);
throw
new
IllegalStateException
(
"Current security principal has no CN"
);
}
}
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/PermissionBeanLocal.java
View file @
000c6fe
...
@@ -4,6 +4,7 @@ import javax.ejb.Local;
...
@@ -4,6 +4,7 @@ import javax.ejb.Local;
import
javax.resource.spi.IllegalStateException
;
import
javax.resource.spi.IllegalStateException
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.SpecialPermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.model.User
;
...
@@ -39,6 +40,8 @@ public interface PermissionBeanLocal {
...
@@ -39,6 +40,8 @@ public interface PermissionBeanLocal {
boolean
isCurrentUser
(
EventUser
user
);
boolean
isCurrentUser
(
EventUser
user
);
boolean
hasPermission
(
SpecialPermission
superadmin
);
// boolean hasPermission(String perm);
// boolean hasPermission(String perm);
}
}
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