소스 검색

fix web authentication action

Keiichi Watanabe 9 년 전
부모
커밋
dea0d21679

+ 3 - 2
src/main/java/org/codelibs/fess/app/web/admin/webauthentication/AdminWebauthenticationAction.java

@@ -140,6 +140,7 @@ public class AdminWebauthenticationAction extends FessAdminAction {
 
     @Execute(token = TxToken.SAVE)
     public HtmlResponse editpage(final int crudMode, final String id) {
+        verifyCrudMode(crudMode, CrudMode.EDIT);
         return asHtml(path_AdminWebauthentication_EditJsp).useForm(EditForm.class, op -> {
             op.setup(form -> {
                 webAuthenticationService.getWebAuthentication(id).ifPresent(entity -> {
@@ -181,7 +182,7 @@ public class AdminWebauthenticationAction extends FessAdminAction {
     public HtmlResponse editfromconfirm(final EditForm form) {
         validate(form, messages -> {}, toEditHtml());
         form.crudMode = CrudMode.EDIT;
-        String id = form.id;
+        final String id = form.id;
         webAuthenticationService.getWebAuthentication(id).ifPresent(entity -> {
             copyBeanToBean(entity, form, op -> {});
         }).orElse(() -> {
@@ -217,7 +218,7 @@ public class AdminWebauthenticationAction extends FessAdminAction {
     public HtmlResponse deletefromconfirm(final EditForm form) {
         validate(form, messages -> {}, toEditHtml());
         form.crudMode = CrudMode.DELETE;
-        String id = form.id;
+        final String id = form.id;
         webAuthenticationService.getWebAuthentication(id).ifPresent(entity -> {
             copyBeanToBean(entity, form, op -> {});
         }).orElse(() -> {

+ 4 - 4
src/main/java/org/codelibs/fess/app/web/admin/webauthentication/CreateForm.java

@@ -34,14 +34,14 @@ public class CreateForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    public int crudMode;
+    public Integer crudMode;
 
     @Size(max = 100)
     public String hostname;
 
     @Min(value = 0)
     @Max(value = 2147483647)
-    public String port;
+    public Integer port;
 
     @Size(max = 100)
     public String authRealm;
@@ -64,7 +64,7 @@ public class CreateForm implements Serializable {
     public String webConfigId;
 
     @Required
-    @Size(max = 255)
+    @Size(max = 1000)
     public String createdBy;
 
     @Required
@@ -72,7 +72,7 @@ public class CreateForm implements Serializable {
 
     public void initialize() {
         crudMode = CrudMode.CREATE;
-        createdBy = "system";
+        createdBy = ComponentUtil.getSystemHelper().getUsername();
         createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
     }
 }