/sun/hostcaptain/trunk/webapp/WEB-INF/struts-config.xml |
---|
34,8 → 34,6 |
<form-property name="login" type="java.lang.String" /> |
<form-property name="password" type="java.lang.String" /> |
<form-property name="password2" type="java.lang.String" /> |
<form-property name="boss" type="java.lang.String" /> |
<form-property name="superuser" type="java.lang.Boolean" /> |
</form-bean> |
<form-bean |
50,7 → 48,6 |
<form-property name="id" type="java.lang.String" /> |
<form-property name="uid" type="java.lang.String" /> |
<form-property name="name" type="java.lang.String" /> |
<form-property name="owner" type="java.lang.String" /> |
</form-bean> |
<form-bean |
/sun/hostcaptain/trunk/webapp/WEB-INF/validation.xml |
---|
43,9 → 43,6 |
<field property="login" depends="required"> |
<msg name="required" key="ak.hostcaptain.core.login.required" /> |
</field> |
<field property="boss" depends="long"> |
<msg name="long" key="ak.hostcaptain.core.user.boss.id.wrong" /> |
</field> |
</form> |
<form name="ak.hostcaptain.core.form.SystemUserForm"> |
65,9 → 62,6 |
<field property="name" depends="required"> |
<msg name="required" key="ak.hostcaptain.core.user.system.edit.name.required" /> |
</field> |
<field property="owner" depends="long"> |
<msg name="long" key="ak.hostcaptain.core.user.system.edit.owner.wrong" /> |
</field> |
</form> |
<form name="ak.hostcaptain.core.form.InetDomainForm"> |
/sun/hostcaptain/trunk/webapp/user/edit.jsp |
---|
32,17 → 32,6 |
<html:password property="password2" redisplay="false" /> |
<br> |
<bean:message key="ak.hostcaptain.page.user.edit.owner" />: |
<html:select property="owner"> |
<html:option value="" key="ak.hostcaptain.page.user.edit.owner.empty"/> |
<html:options collection="users" property="id" labelProperty="login" /> |
</html:select> |
<br> |
<html:checkbox property="superuser" /> |
<bean:message key="ak.hostcaptain.page.user.edit.superuser" /> |
<br> |
<html:submit><bean:message key="ak.hostcaptain.page.user.edit.submit" /></html:submit> |
<backpath:backlink><bean:message key="ak.hostcaptain.page.user.edit.back" /></backpath:backlink> |
/sun/hostcaptain/trunk/webapp/user/system/edit.jsp |
---|
28,13 → 28,6 |
<html:text property="name" /> |
<br> |
<bean:message key="ak.hostcaptain.page.user.system.edit.owner" />: |
<html:select property="owner"> |
<html:option value="" key="ak.hostcaptain.page.user.system.edit.owner.empty"/> |
<html:options collection="users" property="id" labelProperty="login" /> |
</html:select> |
<br> |
<html:submit><bean:message key="ak.hostcaptain.page.user.system.edit.submit" /></html:submit> |
<backpath:backlink><bean:message key="ak.hostcaptain.page.user.system.edit.back" /></backpath:backlink> |
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/action/UserAction.java |
---|
17,7 → 17,6 |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.hostcaptain.util.StringConverter; |
28,17 → 27,7 |
public final class UserAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
initUserList(request); |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
63,13 → 52,9 |
} |
else { |
User u = UserManager.getInstance().get(userId); |
showForm.set("login", u.getLogin()); |
if(u.getBoss() != null) |
showForm.set("boss", StringConverter.toString(u.getBoss().getId())); |
showForm.set("superuser", u.getSuperuser()); |
showForm.set("login", u.getLogin()); |
} |
initUserList(request); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
103,14 → 88,7 |
u = UserManager.getInstance().get(userId); |
} |
u.setLogin((String)theForm.get("login")); |
Long bossId = StringConverter.parseLong(theForm.get("boss")); |
if(bossId == null) |
u.setBoss(UserManager.getInstance().get(bossId)); |
if(!user.equals(u)) // do not allow user to change own superuser status |
u.setSuperuser((Boolean)theForm.get("superuser")); |
u.setLogin((String)theForm.get("login")); |
if(password != null && !password.equals("")) |
u.setNewPassword(password); |
123,12 → 101,4 |
throw new Exception("unknown mapping parameter"); |
} |
} |
private void initUserList(HttpServletRequest request) |
throws Exception |
{ |
List list = new ArrayList(UserManager.getInstance().listUsers()); |
Collections.sort(list, UserManager.LOGIN_COMPARATOR); |
request.setAttribute("users", list); |
} |
} |
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/action/SystemUserAction.java |
---|
17,28 → 17,16 |
import org.apache.struts.action.ActionError; |
import ak.strutsx.RequestUtilsX; |
import ak.strutsx.ErrorHandlerX; |
import ak.backpath.BackPath; |
import ak.hostcaptain.util.StringConverter; |
import ak.hostcaptain.core.model.User; |
import ak.hostcaptain.core.model.UserManager; |
import ak.hostcaptain.core.model.SystemUser; |
import ak.hostcaptain.core.model.SystemUserManager; |
public final class SystemUserAction |
extends Action |
implements ErrorHandlerX |
{ |
public void handleErrors(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
{ |
if("submit".equals(mapping.getParameter())) { |
initUserList(request); |
} |
} |
public ActionForward execute(ActionMapping mapping, ActionForm form, |
HttpServletRequest request, HttpServletResponse response) |
throws Exception |
63,13 → 51,10 |
} |
else { |
SystemUser u = SystemUserManager.getInstance().get(userId); |
showForm.set("uid", StringConverter.toString(u.getUid())); |
showForm.set("name", u.getName()); |
if(u.getOwner() != null) |
showForm.set("owner", StringConverter.toString(u.getOwner().getId())); |
showForm.set("uid", StringConverter.toString(u.getUid())); |
showForm.set("name", u.getName()); |
} |
initUserList(request); |
return mapping.findForward("default"); |
} |
else if("delete".equals(mapping.getParameter())) { |
95,12 → 80,6 |
u.setUid(StringConverter.parseInteger(theForm.get("uid"))); |
u.setName((String)theForm.get("name")); |
Long ownerId = StringConverter.parseLong(theForm.get("owner")); |
if(ownerId == null) |
u.setOwner(null); |
else |
u.setOwner(UserManager.getInstance().get(ownerId)); |
SystemUserManager.getInstance().save(u); |
response.sendRedirect(BackPath.findBackPath(request).getBackwardUrl()); |
110,12 → 89,4 |
throw new Exception("unknown mapping parameter"); |
} |
} |
private void initUserList(HttpServletRequest request) |
throws Exception |
{ |
List list = new ArrayList(UserManager.getInstance().listUsers()); |
Collections.sort(list, UserManager.LOGIN_COMPARATOR); |
request.setAttribute("users", list); |
} |
} |
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/CoreResources.properties |
---|
14,7 → 14,6 |
ak.hostcaptain.core.user.password.change.id.wrong=Please select an user from the list |
ak.hostcaptain.core.user.deletemeself=Can not delete the user you are logged in |
ak.hostcaptain.core.user.boss.id.wrong=Please select a boss from the list |
ak.hostcaptain.core.mailbox.edit.id.wrong=Please select a mailbox from the list |
ak.hostcaptain.core.mailbox.edit.login.empty=You have to enter the login |
33,7 → 32,6 |
ak.hostcaptain.core.user.system.edit.id.wrong=Please select an user from the list |
ak.hostcaptain.core.user.system.edit.uid.wrong=Please enter the UID |
ak.hostcaptain.core.user.system.edit.name.required=Please enter name of the user |
ak.hostcaptain.core.user.system.edit.owner.wrong=Please select an owner from the list |
ak.hostcaptain.core.domain.edit.id.wrong=Please select a domain from the list |
ak.hostcaptain.core.domain.edit.owner.wrong=Please select an owner from the list |
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/SystemUser.java |
---|
14,7 → 14,6 |
/** user id in the OS */ |
private Integer uid; |
private String name; |
private User owner; |
private Date modStamp; |
protected SystemUser() |
62,21 → 61,7 |
{ |
this.name = name; |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public User getOwner() |
{ |
return owner; |
} |
public void setOwner(User owner) |
{ |
this.owner = owner; |
} |
/** |
* |
* @hibernate.timestamp column="mod_stamp" |
/sun/hostcaptain/trunk/src/ak/hostcaptain/core/model/User.java |
---|
10,12 → 10,10 |
public class User |
implements ModelObject |
{ |
private Long id; |
private String login; |
private String password; |
private User boss; |
private Boolean superuser; |
private Date modStamp; |
private Long id; |
private String login; |
private String password; |
private Date modStamp; |
protected User() |
{ |
83,35 → 81,7 |
{ |
return this.password.equals(password); |
} |
/** |
* |
* @hibernate.many-to-one |
*/ |
public User getBoss() |
{ |
return boss; |
} |
public void setBoss(User boss) |
{ |
this.boss = boss; |
} |
/** |
* |
* @hibernate.property |
*/ |
public Boolean getSuperuser() |
{ |
return superuser; |
} |
public void setSuperuser(Boolean superuser) |
{ |
this.superuser = superuser; |
} |
/** |
* |
* @hibernate.timestamp column="mod_stamp" |