1 23 24 package org.infoglue.cms.applications.managementtool.actions; 25 26 import java.util.List ; 27 28 import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy; 29 import org.infoglue.cms.controllers.kernel.impl.simple.UserPropertiesController; 30 import org.infoglue.cms.entities.management.RoleVO; 31 import org.infoglue.cms.entities.management.SystemUserVO; 32 import org.infoglue.cms.exception.SystemException; 33 import org.infoglue.cms.security.InfoGluePrincipal; 34 import org.infoglue.cms.util.CmsPropertyHandler; 35 import org.infoglue.cms.util.ConstraintExceptionBuffer; 36 37 40 41 public class UpdateSystemUserAction extends ViewSystemUserAction { 43 private ConstraintExceptionBuffer ceb; 44 private SystemUserVO systemUserVO; 45 private RoleVO roleVO; 46 private InfoGluePrincipal infoGluePrincipal; 47 private String [] roller; 48 private List defRoles; 49 private String action; 50 private String oldPassword; 51 52 53 public UpdateSystemUserAction() 54 { 55 this(new SystemUserVO()); 56 } 57 58 public UpdateSystemUserAction(SystemUserVO systemUserVO) 59 { 60 this.systemUserVO = systemUserVO; 61 this.ceb = new ConstraintExceptionBuffer(); 62 } 63 64 public String doExecute() throws Exception  65 { 66 super.initialize(this.getInfoGluePrincipal().getName()); 67 68 ceb = this.systemUserVO.validate(); 69 ceb.throwIfNotEmpty(); 70 71 String [] roles = getRequest().getParameterValues("roleName"); 72 String [] groups = getRequest().getParameterValues("groupName"); 73 String [] contentTypeDefinitionIds = getRequest().getParameterValues("contentTypeDefinitionId"); 74 75 UserControllerProxy.getController().updateUser(this.systemUserVO, roles, groups); 76 if(contentTypeDefinitionIds != null && contentTypeDefinitionIds.length > 0 && !contentTypeDefinitionIds[0].equals("")) 77 UserPropertiesController.getController().updateContentTypeDefinitions(this.getUserName(), contentTypeDefinitionIds); 78 79 return "success"; 80 81 } 82 83 public String doSaveAndExit() throws Exception  84 { 85 doExecute(); 86 87 return "saveAndExit"; 88 } 89 90 public String doChangePassword() throws Exception  91 { 92 if(this.systemUserVO.getUserName().equals(CmsPropertyHandler.getAnonymousUser())) 93 throw new SystemException("You must not change password on this user as it's needed by the system."); 94 95 UserControllerProxy.getController().updateUserPassword(this.systemUserVO.getUserName()); 96 97 return "passwordSentSuccess"; 98 } 99 100 private String [] getRoller() 101 { 102 return this.roller; 103 } 104 105 public java.lang.String getFirstName() 106 { 107 return this.systemUserVO.getFirstName(); 108 } 109 110 public void setFirstName(java.lang.String firstName) 111 { 112 this.systemUserVO.setFirstName(firstName); 113 } 114 115 public java.lang.String getLastName() 116 { 117 return this.systemUserVO.getLastName(); 118 } 119 120 public void setLastName(java.lang.String lastName) 121 { 122 this.systemUserVO.setLastName(lastName); 123 } 124 125 public String getUserName() 126 { 127 return this.systemUserVO.getUserName(); 128 } 129 130 public void setUserName(String userName) 131 { 132 this.systemUserVO.setUserName(userName); 133 } 134 135 public java.lang.String getEmail() 136 { 137 return this.systemUserVO.getEmail(); 138 } 139 140 141 public void setEmail(java.lang.String email) throws Exception  142 { 143 this.systemUserVO.setEmail(email); 144 } 145 146 public java.lang.String getPassword() 147 { 148 return this.systemUserVO.getPassword(); 149 } 150 151 public void setPassword(java.lang.String password) 152 { 153 this.systemUserVO.setPassword(password); 154 } 155 156 public void setOldPassword(java.lang.String oldPassword) 157 { 158 this.oldPassword = oldPassword; 159 } 160 161 public void setAction(String action) 162 { 163 this.action = action; 164 } 165 166 public String getAction() 167 { 168 return this.action; 169 } 170 171 172 173 174 } 175 | Popular Tags |