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 21bd2932
authored
May 12, 2012
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing beans
1 parent
edf867c4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
23 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/JaasBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/LoggingBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/LoggingBeanLocal.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceBeanLocal.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/BillBean.java
View file @
21bd293
...
@@ -21,7 +21,6 @@ import fi.insomnia.bortal.enums.apps.BillPermission;
...
@@ -21,7 +21,6 @@ import fi.insomnia.bortal.enums.apps.BillPermission;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.facade.BillFacade
;
import
fi.insomnia.bortal.facade.BillFacade
;
import
fi.insomnia.bortal.facade.BillLineFacade
;
import
fi.insomnia.bortal.facade.BillLineFacade
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.Bill
;
import
fi.insomnia.bortal.model.Bill
;
import
fi.insomnia.bortal.model.BillLine
;
import
fi.insomnia.bortal.model.BillLine
;
...
@@ -63,10 +62,6 @@ public class BillBean implements BillBeanLocal {
...
@@ -63,10 +62,6 @@ public class BillBean implements BillBeanLocal {
private
PlaceBean
placebean
;
private
PlaceBean
placebean
;
@EJB
@EJB
private
PermissionBeanLocal
permissionbean
;
@EJB
private
UserFacade
userfacade
;
@EJB
private
UtilBean
utilbean
;
private
UtilBean
utilbean
;
@EJB
@EJB
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/JaasBean.java
View file @
21bd293
...
@@ -69,10 +69,10 @@ public class JaasBean implements JaasBeanLocal, JaasBeanRemote {
...
@@ -69,10 +69,10 @@ public class JaasBean implements JaasBeanLocal, JaasBeanRemote {
}
else
if
(
eventUser
.
checkPassword
(
password
))
{
}
else
if
(
eventUser
.
checkPassword
(
password
))
{
ret
=
eventUser
;
ret
=
eventUser
;
}
else
{
}
else
{
secubean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
eventUser
,
"Login failed: wrong password for username "
,
username
);
secubean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
eventUser
.
getUser
()
,
"Login failed: wrong password for username "
,
username
);
}
}
}
else
{
}
else
{
secubean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
null
,
"Login failed: Username not found: "
,
username
);
secubean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
(
User
)
null
,
"Login failed: Username not found: "
,
username
);
}
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/LoggingBean.java
View file @
21bd293
...
@@ -13,9 +13,10 @@ import org.slf4j.Logger;
...
@@ -13,9 +13,10 @@ import org.slf4j.Logger;
import
fi.insomnia.bortal.facade.LogEntryFacade
;
import
fi.insomnia.bortal.facade.LogEntryFacade
;
import
fi.insomnia.bortal.facade.LogEntryTypeFacade
;
import
fi.insomnia.bortal.facade.LogEntryTypeFacade
;
import
fi.insomnia.bortal.model.
I
User
;
import
fi.insomnia.bortal.model.
Event
User
;
import
fi.insomnia.bortal.model.LogEntry
;
import
fi.insomnia.bortal.model.LogEntry
;
import
fi.insomnia.bortal.model.LogEntryType
;
import
fi.insomnia.bortal.model.LogEntryType
;
import
fi.insomnia.bortal.model.User
;
/**
/**
* Session Bean implementation class SercurityBean
* Session Bean implementation class SercurityBean
...
@@ -26,7 +27,8 @@ public class LoggingBean implements LoggingBeanLocal {
...
@@ -26,7 +27,8 @@ public class LoggingBean implements LoggingBeanLocal {
private
static
final
boolean
DEBUG
=
true
;
private
static
final
boolean
DEBUG
=
true
;
private
final
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
LoggingBean
.
class
);
private
final
Logger
logger
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
LoggingBean
.
class
);
@EJB
@EJB
private
LogEntryTypeFacade
typeFacade
;
private
LogEntryTypeFacade
typeFacade
;
@EJB
@EJB
...
@@ -84,7 +86,8 @@ public class LoggingBean implements LoggingBeanLocal {
...
@@ -84,7 +86,8 @@ public class LoggingBean implements LoggingBeanLocal {
// }
// }
@Override
@Override
public
LogEntry
logMessage
(
SecurityLogType
paramType
,
IUser
user
,
String
...
description
)
{
public
LogEntry
logMessage
(
SecurityLogType
paramType
,
User
user
,
String
...
description
)
{
LogEntry
entry
=
null
;
LogEntry
entry
=
null
;
try
{
try
{
String
desc
=
toString
(
description
);
String
desc
=
toString
(
description
);
...
@@ -97,7 +100,10 @@ public class LoggingBean implements LoggingBeanLocal {
...
@@ -97,7 +100,10 @@ public class LoggingBean implements LoggingBeanLocal {
entryFacade
.
create
(
entry
);
entryFacade
.
create
(
entry
);
if
(
DEBUG
)
{
if
(
DEBUG
)
{
logger
.
debug
(
"SECURITY DEBUG: Type: \"{}\" user \"{}\", description \"{}\""
,
new
String
[]
{
paramType
.
name
(),
(
user
==
null
)
?
"null"
:
user
.
getLogin
(),
desc
});
logger
.
debug
(
"SECURITY DEBUG: Type: \"{}\" user \"{}\", description \"{}\""
,
new
String
[]
{
paramType
.
name
(),
(
user
==
null
)
?
"null"
:
user
.
getLogin
(),
desc
});
}
}
utx
.
commit
();
utx
.
commit
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -106,6 +112,12 @@ public class LoggingBean implements LoggingBeanLocal {
...
@@ -106,6 +112,12 @@ public class LoggingBean implements LoggingBeanLocal {
return
entry
;
return
entry
;
}
}
@Override
public
LogEntry
logMessage
(
SecurityLogType
paramType
,
EventUser
user
,
String
...
description
)
{
return
logMessage
(
paramType
,
user
.
getUser
(),
description
);
}
private
static
final
String
toString
(
String
...
desc
)
{
private
static
final
String
toString
(
String
...
desc
)
{
StringBuilder
msg
=
new
StringBuilder
();
StringBuilder
msg
=
new
StringBuilder
();
for
(
String
msgpart
:
desc
)
{
for
(
String
msgpart
:
desc
)
{
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceBean.java
View file @
21bd293
...
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
...
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.enums.apps.SpecialPermission
;
import
fi.insomnia.bortal.exceptions.BortalCatchableException
;
import
fi.insomnia.bortal.exceptions.BortalCatchableException
;
import
fi.insomnia.bortal.facade.EventUserFacade
;
import
fi.insomnia.bortal.facade.GroupMembershipFacade
;
import
fi.insomnia.bortal.facade.GroupMembershipFacade
;
import
fi.insomnia.bortal.facade.PlaceFacade
;
import
fi.insomnia.bortal.facade.PlaceFacade
;
import
fi.insomnia.bortal.facade.PlaceGroupFacade
;
import
fi.insomnia.bortal.facade.PlaceGroupFacade
;
...
@@ -44,7 +45,6 @@ import fi.insomnia.bortal.model.LanEvent;
...
@@ -44,7 +45,6 @@ import fi.insomnia.bortal.model.LanEvent;
import
fi.insomnia.bortal.model.Place
;
import
fi.insomnia.bortal.model.Place
;
import
fi.insomnia.bortal.model.PlaceGroup
;
import
fi.insomnia.bortal.model.PlaceGroup
;
import
fi.insomnia.bortal.model.Product
;
import
fi.insomnia.bortal.model.Product
;
import
fi.insomnia.bortal.model.User
;
/**
/**
*
*
...
@@ -77,8 +77,13 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -77,8 +77,13 @@ public class PlaceBean implements PlaceBeanLocal {
private
LoggingBeanLocal
logbean
;
private
LoggingBeanLocal
logbean
;
@EJB
@EJB
private
PermissionBeanLocal
permbean
;
private
PermissionBeanLocal
permbean
;
@EJB
@EJB
private
UserFacade
userfacade
;
private
UserFacade
userfacade
;
@EJB
private
EventUserFacade
eventUserFacade
;
@EJB
@EJB
private
LoggingBeanLocal
loggerbean
;
private
LoggingBeanLocal
loggerbean
;
@EJB
@EJB
...
@@ -111,7 +116,7 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -111,7 +116,7 @@ public class PlaceBean implements PlaceBeanLocal {
@RolesAllowed
(
MapPermission
.
S_MANAGE_OTHERS
)
@RolesAllowed
(
MapPermission
.
S_MANAGE_OTHERS
)
@Override
@Override
public
BigDecimal
getTotalReservationPrice
(
I
User
user
,
Place
newPlace
)
public
BigDecimal
getTotalReservationPrice
(
Event
User
user
,
Place
newPlace
)
{
{
return
addAndCalcPrice
(
user
,
newPlace
);
return
addAndCalcPrice
(
user
,
newPlace
);
...
@@ -175,9 +180,9 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -175,9 +180,9 @@ public class PlaceBean implements PlaceBeanLocal {
*/
*/
@Override
@Override
@RolesAllowed
(
MapPermission
.
S_BUY_PLACES
)
@RolesAllowed
(
MapPermission
.
S_BUY_PLACES
)
public
boolean
reservePlace
(
Place
place
,
User
user
)
{
public
boolean
reservePlace
(
Place
place
,
Event
User
user
)
{
place
=
placeFacade
.
find
(
place
.
getId
());
place
=
placeFacade
.
find
(
place
.
getId
());
user
=
userf
acade
.
find
(
user
.
getId
());
user
=
eventUserF
acade
.
find
(
user
.
getId
());
boolean
ret
=
false
;
boolean
ret
=
false
;
if
(
place
.
isBuyable
()
&&
!
place
.
isTaken
())
{
if
(
place
.
isBuyable
()
&&
!
place
.
isTaken
())
{
place
.
setCurrentUser
(
user
);
place
.
setCurrentUser
(
user
);
...
@@ -231,7 +236,7 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -231,7 +236,7 @@ public class PlaceBean implements PlaceBeanLocal {
loggerbean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
permbean
.
getCurrentUser
(),
"Can not buy places for user "
+
user
);
loggerbean
.
logMessage
(
SecurityLogType
.
permissionDenied
,
permbean
.
getCurrentUser
(),
"Can not buy places for user "
+
user
);
throw
new
EJBAccessException
(
"Not enough permissions to buy place"
);
throw
new
EJBAccessException
(
"Not enough permissions to buy place"
);
}
}
user
=
userf
acade
.
find
(
user
.
getId
());
user
=
eventUserF
acade
.
find
(
user
.
getId
());
}
}
LanEvent
event
=
eventBean
.
getCurrentEvent
();
LanEvent
event
=
eventBean
.
getCurrentEvent
();
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/LoggingBeanLocal.java
View file @
21bd293
...
@@ -2,12 +2,14 @@ package fi.insomnia.bortal.beans;
...
@@ -2,12 +2,14 @@ package fi.insomnia.bortal.beans;
import
javax.ejb.Local
;
import
javax.ejb.Local
;
import
fi.insomnia.bortal.model.
I
User
;
import
fi.insomnia.bortal.model.
Event
User
;
import
fi.insomnia.bortal.model.LogEntry
;
import
fi.insomnia.bortal.model.LogEntry
;
import
fi.insomnia.bortal.model.User
;
@Local
@Local
public
interface
LoggingBeanLocal
{
public
interface
LoggingBeanLocal
{
LogEntry
logMessage
(
SecurityLogType
paramType
,
IUser
user
,
String
...
description
);
LogEntry
logMessage
(
SecurityLogType
paramType
,
User
user
,
String
...
description
);
LogEntry
logMessage
(
SecurityLogType
paramType
,
EventUser
user
,
String
...
description
);
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceBeanLocal.java
View file @
21bd293
...
@@ -11,10 +11,9 @@ import javax.ejb.Local;
...
@@ -11,10 +11,9 @@ import javax.ejb.Local;
import
fi.insomnia.bortal.exceptions.BortalCatchableException
;
import
fi.insomnia.bortal.exceptions.BortalCatchableException
;
import
fi.insomnia.bortal.model.EventMap
;
import
fi.insomnia.bortal.model.EventMap
;
import
fi.insomnia.bortal.model.
I
User
;
import
fi.insomnia.bortal.model.
Event
User
;
import
fi.insomnia.bortal.model.Place
;
import
fi.insomnia.bortal.model.Place
;
import
fi.insomnia.bortal.model.PlaceGroup
;
import
fi.insomnia.bortal.model.PlaceGroup
;
import
fi.insomnia.bortal.model.User
;
/**
/**
*
*
...
@@ -26,7 +25,7 @@ public interface PlaceBeanLocal {
...
@@ -26,7 +25,7 @@ public interface PlaceBeanLocal {
Place
findPlace
(
EventMap
e
,
int
x
,
int
y
);
Place
findPlace
(
EventMap
e
,
int
x
,
int
y
);
boolean
reservePlace
(
Place
place
,
User
user
);
boolean
reservePlace
(
Place
place
,
Event
User
user
);
int
setBuyable
(
EventMap
map
,
String
buyableLike
,
boolean
b
);
int
setBuyable
(
EventMap
map
,
String
buyableLike
,
boolean
b
);
...
@@ -36,7 +35,7 @@ public interface PlaceBeanLocal {
...
@@ -36,7 +35,7 @@ public interface PlaceBeanLocal {
Place
mergeChanges
(
Place
place
);
Place
mergeChanges
(
Place
place
);
PlaceGroup
buySelectedPlaces
(
User
user
)
throws
BortalCatchableException
;
PlaceGroup
buySelectedPlaces
(
Event
User
user
)
throws
BortalCatchableException
;
// void releaseUsersPlaces(User user) throws PermissionDeniedException;
// void releaseUsersPlaces(User user) throws PermissionDeniedException;
...
@@ -44,7 +43,7 @@ public interface PlaceBeanLocal {
...
@@ -44,7 +43,7 @@ public interface PlaceBeanLocal {
void
unbuyPlace
(
Place
place
);
void
unbuyPlace
(
Place
place
);
BigDecimal
getTotalReservationPrice
(
I
User
user
,
Place
newPlace
);
BigDecimal
getTotalReservationPrice
(
Event
User
user
,
Place
newPlace
);
BigDecimal
getTotalReservationPrice
(
Place
newPlace
);
BigDecimal
getTotalReservationPrice
(
Place
newPlace
);
...
...
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