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
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
12 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
code/LanBortalWeb/WebContent/useradmin/create.xhtml
View file @
35db1aa
...
...
@@ -12,7 +12,7 @@
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.user.create"
/>
<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:composition>
...
...
code/LanBortalWeb/WebContent/useradmin/list.xhtml
View file @
35db1aa
...
...
@@ -49,7 +49,7 @@
<div
id=
"usercart"
style=
"display: #{((userCartView.isEmpty())?'none':'block')};"
>
<h:outputText
value=
"#{i18n['usercart.cartsize']}"
/>
<h:outputText
value=
" #{userCartView.userCartSize}"
/>
<h:commandButton
action=
"#{userCartView.clearCart}"
value=
"#{i18n['usercart.clear']}"
/>
<h:commandButton
action=
"#{userCartView.clearCart
()
}"
value=
"#{i18n['usercart.clear']}"
/>
<br
/>
<h:commandButton
actionListener=
"#{userSearchView.addToCart}"
value=
"#{i18n['usercart.addSearcherUsers']}"
/>
<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 {
updateCurrent
();
return
"/useradmin/userCartShow"
;
}
else
return
"/useradmin/list"
;
else
return
"/useradmin/list"
;
}
public
String
saveUser
()
{
...
...
@@ -102,10 +103,10 @@ public class UserCartView extends GenericCDIView {
}
public
void
clearCart
()
{
public
String
clearCart
()
{
if
(
usercart
!=
null
)
usercart
.
clear
();
//
return null;
return
null
;
}
public
boolean
isEmpty
()
{
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserValidator.java
View file @
35db1aa
...
...
@@ -39,7 +39,7 @@ public class UserValidator implements Serializable {
public
void
validateEmail
(
FacesContext
context
,
UIComponent
ui
,
Object
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"
);
}
}
...
...
@@ -72,11 +72,12 @@ public class UserValidator implements Serializable {
logger
.
info
(
"Setting firstpwd to {} as {}"
,
firstpwd
,
object
.
getClass
());
return
;
}
}
logger
.
info
(
"Checking length"
);
if
(!
firstpwd
.
equals
(
object
))
{
message
(
context
,
ui
,
"userview.passwordsDontMatch"
);
}
}
logger
.
info
(
"Done pwd"
);
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/user/UserView.java
View file @
35db1aa
...
...
@@ -142,8 +142,8 @@ public class UserView extends GenericCDIView {
// user = userbean.getEventUser(img.getUser());
// croppedImage = null;
if
(
croppedImage
==
null
)
return
null
;
if
(
croppedImage
==
null
)
return
null
;
logger
.
info
(
"Cropped image {}x{}"
,
croppedImage
.
getLeft
(),
croppedImage
.
getTop
());
logger
.
info
(
"Cropped data bytesize {}, type {}"
,
croppedImage
.
getBytes
().
length
,
croppedImage
.
getOriginalFilename
());
...
...
@@ -166,18 +166,18 @@ public class UserView extends GenericCDIView {
try
{
mpr
=
cardPrintBean
.
getUserCardAsPrintablePdf
(
this
.
user
.
getId
());
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
file
=
File
.
createTempFile
(
"cardprintout"
,
null
);
FileOutputStream
fostream
=
new
FileOutputStream
(
file
);
fostream
.
write
(
mpr
.
getPdf
());
fostream
.
close
();
setStreamedFile
(
new
DefaultStreamedContent
(
new
FileInputStream
(
this
.
file
)));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FacesContext
.
getCurrentInstance
().
addMessage
(
null
,
new
FacesMessage
(
e
.
getMessage
()));
}
}
public
String
acceptPrintedCard
()
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
if
(
mpr
!=
null
&&
mpr
.
getAffectedUsers
().
size
()
>
0
)
{
cardPrintBean
.
acceptMassPrintResult
(
mpr
);
return
"accepted"
;
}
else
{
...
...
@@ -290,6 +290,12 @@ public class UserView extends GenericCDIView {
return
"/user/created"
;
}
public
String
createAdminUser
()
{
userbean
.
createNewUser
(
user
,
getPassword
());
canSave
=
permbean
.
hasPermission
(
UserPermission
.
MODIFY
);
return
"/useradmin/edit"
;
}
public
void
setUserid
(
Integer
userid
)
{
this
.
userid
=
userid
;
}
...
...
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