1 13 14 package org.ejbca.ui.web.admin.configuration; 15 16 import javax.naming.Context ; 17 import javax.naming.InitialContext ; 18 import javax.naming.NamingException ; 19 20 import org.ejbca.core.ejb.authorization.IAuthorizationSessionLocal; 21 import org.ejbca.core.ejb.ra.raadmin.IRaAdminSessionLocal; 22 import org.ejbca.core.model.authorization.AuthorizationDeniedException; 23 import org.ejbca.core.model.log.Admin; 24 import org.ejbca.core.model.ra.raadmin.GlobalConfiguration; 25 26 33 public class GlobalConfigurationDataHandler implements java.io.Serializable { 34 35 36 public GlobalConfigurationDataHandler(Admin administrator,IRaAdminSessionLocal raadminsession, IAuthorizationSessionLocal authorizationsession){ 37 this.raadminsession = raadminsession; 38 this.authorizationsession = authorizationsession; 39 this.administrator = administrator; 40 } 41 42 public GlobalConfiguration loadGlobalConfiguration() throws NamingException { 43 GlobalConfiguration ret = null; 44 45 ret = raadminsession.loadGlobalConfiguration(administrator); 46 InitialContext ictx = new InitialContext (); 47 Context myenv = (Context ) ictx.lookup("java:comp/env"); 48 ret.initialize( (String ) myenv.lookup("ADMINDIRECTORY"), 49 (String ) myenv.lookup("AVAILABLELANGUAGES"), (String ) myenv.lookup("AVAILABLETHEMES"), 50 (String ) myenv.lookup("PUBLICPORT"),(String ) myenv.lookup("PRIVATEPORT"), 51 (String ) myenv.lookup("PUBLICPROTOCOL"),(String ) myenv.lookup("PRIVATEPROTOCOL")); 52 return ret; 53 } 54 55 public void saveGlobalConfiguration(GlobalConfiguration gc) throws AuthorizationDeniedException { 56 if(this.authorizationsession.isAuthorizedNoLog(administrator, "/super_administrator")) 57 raadminsession.saveGlobalConfiguration(administrator, gc); 58 } 59 60 private IRaAdminSessionLocal raadminsession; 62 private IAuthorizationSessionLocal authorizationsession; 63 private Admin administrator; 64 } 65 | Popular Tags |