Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 35db1aa9
authored
Oct 25, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow admin to create user without validators..
1 parent
8bea3338
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
27 deletions
code/LanBortalWeb/WebContent/user/create.xhtml
code/LanBortalWeb/WebContent/useradmin/create.xhtml
code/LanBortalWeb/WebContent/useradmin/list.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserValidator.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
code/LanBortalWeb/WebContent/user/create.xhtml
View file @
35db1aa
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<f:event
type=
"preRenderView"
listener=
"#{userView.initCreateView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{userView.initCreateView}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<users:create
creating=
"true"
commitaction=
"#{userView.createUser()}"
commitvalue=
"#{i18n['user.create']}"
/>
<users:create
creating=
"true"
commitaction=
"#{userView.createUser()}"
commitvalue=
"#{i18n['user.create']}"
/>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
...
...
code/LanBortalWeb/WebContent/useradmin/create.xhtml
View file @
35db1aa
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
</f:metadata>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.user.create"
/>
<ui:param
name=
"thispage"
value=
"page.user.create"
/>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<users:create
creating=
"true"
commitaction=
"#{userView.createUser()}"
commitvalue=
"#{i18n['user.create']}"
/>
<users:create
creating=
"true"
commitaction=
"#{userView.create
Admin
User()}"
commitvalue=
"#{i18n['user.create']}"
/>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
...
...
code/LanBortalWeb/WebContent/useradmin/list.xhtml
View file @
35db1aa
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<div
id=
"usercart"
style=
"display: #{((userCartView.isEmpty())?'none':'block')};"
>
<div
id=
"usercart"
style=
"display: #{((userCartView.isEmpty())?'none':'block')};"
>
<h:outputText
value=
"#{i18n['usercart.cartsize']}"
/>
<h:outputText
value=
"#{i18n['usercart.cartsize']}"
/>
<h:outputText
value=
" #{userCartView.userCartSize}"
/>
<h:outputText
value=
" #{userCartView.userCartSize}"
/>
<h:commandButton
action=
"#{userCartView.clearCart}"
value=
"#{i18n['usercart.clear']}"
/>
<h:commandButton
action=
"#{userCartView.clearCart
()
}"
value=
"#{i18n['usercart.clear']}"
/>
<br
/>
<br
/>
<h:commandButton
actionListener=
"#{userSearchView.addToCart}"
value=
"#{i18n['usercart.addSearcherUsers']}"
/>
<h:commandButton
actionListener=
"#{userSearchView.addToCart}"
value=
"#{i18n['usercart.addSearcherUsers']}"
/>
<h:commandButton
action=
"#{userCartView.traverse}"
value=
"#{i18n['usercart.traverse']}"
/>
<h:commandButton
action=
"#{userCartView.traverse}"
value=
"#{i18n['usercart.traverse']}"
/>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserCartView.java
View file @
35db1aa
...
@@ -69,7 +69,8 @@ public class UserCartView extends GenericCDIView {
...
@@ -69,7 +69,8 @@ public class UserCartView extends GenericCDIView {
updateCurrent
();
updateCurrent
();
return
"/useradmin/userCartShow"
;
return
"/useradmin/userCartShow"
;
}
}
else
return
"/useradmin/list"
;
else
return
"/useradmin/list"
;
}
}
public
String
saveUser
()
{
public
String
saveUser
()
{
...
@@ -102,12 +103,12 @@ public class UserCartView extends GenericCDIView {
...
@@ -102,12 +103,12 @@ public class UserCartView extends GenericCDIView {
}
}
public
void
clearCart
()
{
public
String
clearCart
()
{
if
(
usercart
!=
null
)
if
(
usercart
!=
null
)
usercart
.
clear
();
usercart
.
clear
();
//
return null;
return
null
;
}
}
public
boolean
isEmpty
()
{
public
boolean
isEmpty
()
{
return
usercart
==
null
||
usercart
.
isEmpty
();
return
usercart
==
null
||
usercart
.
isEmpty
();
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserValidator.java
View file @
35db1aa
...
@@ -39,7 +39,7 @@ public class UserValidator implements Serializable {
...
@@ -39,7 +39,7 @@ public class UserValidator implements Serializable {
public
void
validateEmail
(
FacesContext
context
,
UIComponent
ui
,
Object
value
)
{
public
void
validateEmail
(
FacesContext
context
,
UIComponent
ui
,
Object
value
)
{
String
email
=
(
String
)
value
;
String
email
=
(
String
)
value
;
if
(!
permbean
.
hasPermission
(
UserPermission
.
MODIFY
)
&&
email
.
indexOf
(
'@'
)
==
-
1
)
{
if
(!
permbean
.
hasPermission
(
UserPermission
.
MODIFY
)
&&
(
email
==
null
||
email
.
indexOf
(
'@'
)
==
-
1
)
)
{
message
(
context
,
ui
,
"userview.invalidEmail"
);
message
(
context
,
ui
,
"userview.invalidEmail"
);
}
}
}
}
...
@@ -72,10 +72,11 @@ public class UserValidator implements Serializable {
...
@@ -72,10 +72,11 @@ public class UserValidator implements Serializable {
logger
.
info
(
"Setting firstpwd to {} as {}"
,
firstpwd
,
object
.
getClass
());
logger
.
info
(
"Setting firstpwd to {} as {}"
,
firstpwd
,
object
.
getClass
());
return
;
return
;
}
}
}
logger
.
info
(
"Checking length"
);
logger
.
info
(
"Checking length"
);
if
(!
firstpwd
.
equals
(
object
))
{
if
(!
firstpwd
.
equals
(
object
))
{
message
(
context
,
ui
,
"userview.passwordsDontMatch"
);
message
(
context
,
ui
,
"userview.passwordsDontMatch"
);
}
}
}
logger
.
info
(
"Done pwd"
);
logger
.
info
(
"Done pwd"
);
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
View file @
35db1aa
...
@@ -85,10 +85,10 @@ public class UserView extends GenericCDIView {
...
@@ -85,10 +85,10 @@ public class UserView extends GenericCDIView {
private
transient
EventBeanLocal
eventbean
;
private
transient
EventBeanLocal
eventbean
;
@EJB
@EJB
private
transient
CardPrintBeanLocal
cardPrintBean
;
private
transient
CardPrintBeanLocal
cardPrintBean
;
private
File
file
;
private
File
file
;
private
StreamedContent
streamedFile
;
private
StreamedContent
streamedFile
;
private
MassPrintResult
mpr
=
null
;
private
MassPrintResult
mpr
=
null
;
private
boolean
waitForAcceptance
=
false
;
private
boolean
waitForAcceptance
=
false
;
...
@@ -142,13 +142,13 @@ public class UserView extends GenericCDIView {
...
@@ -142,13 +142,13 @@ public class UserView extends GenericCDIView {
// user = userbean.getEventUser(img.getUser());
// user = userbean.getEventUser(img.getUser());
// croppedImage = null;
// croppedImage = null;
if
(
croppedImage
==
null
)
if
(
croppedImage
==
null
)
return
null
;
return
null
;
logger
.
info
(
"Cropped image {}x{}"
,
croppedImage
.
getLeft
(),
croppedImage
.
getTop
());
logger
.
info
(
"Cropped image {}x{}"
,
croppedImage
.
getLeft
(),
croppedImage
.
getTop
());
logger
.
info
(
"Cropped data bytesize {}, type {}"
,
croppedImage
.
getBytes
().
length
,
croppedImage
.
getOriginalFilename
());
logger
.
info
(
"Cropped data bytesize {}, type {}"
,
croppedImage
.
getBytes
().
length
,
croppedImage
.
getOriginalFilename
());
try
{
try
{
UserImage
newImage
=
UserImage
newImage
=
userbean
.
saveCroppedImage
(
user
.
getUser
().
getCurrentImage
(),
userbean
.
saveCroppedImage
(
user
.
getUser
().
getCurrentImage
(),
croppedImage
.
getLeft
(),
croppedImage
.
getTop
(),
croppedImage
.
getLeft
(),
croppedImage
.
getTop
(),
...
@@ -160,29 +160,29 @@ public class UserView extends GenericCDIView {
...
@@ -160,29 +160,29 @@ public class UserView extends GenericCDIView {
}
}
return
null
;
return
null
;
}
}
public
void
prepareCardDownload
()
{
public
void
prepareCardDownload
()
{
file
=
null
;
file
=
null
;
try
{
try
{
mpr
=
cardPrintBean
.
getUserCardAsPrintablePdf
(
this
.
user
.
getId
());
mpr
=
cardPrintBean
.
getUserCardAsPrintablePdf
(
this
.
user
.
getId
());
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
FileOutputStream
fostream
=
new
FileOutputStream
(
file
);
FileOutputStream
fostream
=
new
FileOutputStream
(
file
);
fostream
.
write
(
mpr
.
getPdf
());
fostream
.
write
(
mpr
.
getPdf
());
fostream
.
close
();
fostream
.
close
();
setStreamedFile
(
new
DefaultStreamedContent
(
new
FileInputStream
(
this
.
file
)));
setStreamedFile
(
new
DefaultStreamedContent
(
new
FileInputStream
(
this
.
file
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
e
.
getMessage
()));
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
e
.
getMessage
()));
}
}
}
}
public
String
acceptPrintedCard
()
{
public
String
acceptPrintedCard
()
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
cardPrintBean
.
acceptMassPrintResult
(
mpr
);
cardPrintBean
.
acceptMassPrintResult
(
mpr
);
return
"accepted"
;
return
"accepted"
;
}
else
{
}
else
{
return
"failure"
;
return
"failure"
;
}
}
}
}
...
@@ -290,6 +290,12 @@ public class UserView extends GenericCDIView {
...
@@ -290,6 +290,12 @@ public class UserView extends GenericCDIView {
return
"/user/created"
;
return
"/user/created"
;
}
}
public
String
createAdminUser
()
{
userbean
.
createNewUser
(
user
,
getPassword
());
canSave
=
permbean
.
hasPermission
(
UserPermission
.
MODIFY
);
return
"/useradmin/edit"
;
}
public
void
setUserid
(
Integer
userid
)
{
public
void
setUserid
(
Integer
userid
)
{
this
.
userid
=
userid
;
this
.
userid
=
userid
;
}
}
...
@@ -357,7 +363,7 @@ public class UserView extends GenericCDIView {
...
@@ -357,7 +363,7 @@ public class UserView extends GenericCDIView {
public
void
raiseWaitForAcceptance
()
{
public
void
raiseWaitForAcceptance
()
{
waitForAcceptance
=
true
;
waitForAcceptance
=
true
;
}
}
public
boolean
isWaitForAcceptance
()
{
public
boolean
isWaitForAcceptance
()
{
return
waitForAcceptance
;
return
waitForAcceptance
;
}
}
...
...
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