Project

General

Profile

« Previous | Next » 

Revision 4704

Added by daigle almost 16 years ago

Handle backup configuration action

View differences:

src/edu/ucsb/nceas/metacat/admin/MetaCatAdminServlet.java
41 41
import edu.ucsb.nceas.metacat.MetaCatServlet;
42 42
import edu.ucsb.nceas.metacat.service.PropertyService;
43 43
import edu.ucsb.nceas.metacat.service.SessionService;
44
import edu.ucsb.nceas.metacat.service.XMLSchemaService;
45 44
import edu.ucsb.nceas.metacat.util.AuthUtil;
46
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
47
//import edu.ucsb.nceas.metacat.util.OrganizationUtil;
45
import edu.ucsb.nceas.metacat.util.MetacatUtil;
48 46
import edu.ucsb.nceas.metacat.util.RequestUtil;
49 47
import edu.ucsb.nceas.metacat.util.SkinUtil;
50 48
import edu.ucsb.nceas.metacat.util.SystemUtil;
......
105 103
				SessionService.touchSession(httpSession.getId());
106 104
			}
107 105
			
108
			// if authentication isn't configured, change the action to auth.  
109
			// Authentication needs to be set up before we do anything else
110
			if (!AuthUtil.isAuthConfigured()) {
106
			if (!MetacatUtil.isBackupDirConfigured()) {	
107
				// If the user is logged in, make sure the backup directory has been configured.
108
				// If not, go to the backup configuration page.
109
				processingMessage.add("You must configure the backup directory" + 
110
						" before you can continue with Metacat configuration.");
111
				RequestUtil.setRequestMessage(request, processingMessage);
112
				action = "backup";
113
				logMetacat.debug("Admin action changed to 'backup'");
114
			} else if (!AuthUtil.isAuthConfigured()) {
115
				// if authentication isn't configured, change the action to auth.  
116
				// Authentication needs to be set up before we do anything else
111 117
				processingMessage.add("You must configure authentication before "
112 118
						+ "you can continue with MetaCat configuration.");
113 119
				RequestUtil.setRequestMessage(request, processingMessage);
114 120
				action = "auth";
115 121
				logMetacat.debug("Admin action changed to 'auth'");
116
			}
117

  
118
			// Once auth is configured, see if the user is logged in
119
			// as an administrator.  If not, they need to log in before
120
			// they can continue with configuration.
121
			if (AuthUtil.isAuthConfigured()
122
					&& !AuthUtil.isUserLoggedInAsAdmin(request)) {
122
			} else if (!AuthUtil.isUserLoggedInAsAdmin(request)) {
123
				// If auth is configured, see if the user is logged in
124
				// as an administrator.  If not, they need to log in before
125
				// they can continue with configuration.
123 126
				processingMessage.add("You must log in as an administrative " + "" +
124 127
						"user before you can continue with MetaCat configuration.");
125 128
				RequestUtil.setRequestMessage(request, processingMessage);
126 129
				action = "login";
127 130
				logMetacat.debug("Admin action changed to 'login'");
128
			}
131
			}  
129 132

  
130 133
			if (action == null || action.equals("configure")) {
131 134
				// Forward the request main configuration page
......
135 138
			    // TODO MCD figure out if we still need an org section
136 139
			    //request.setAttribute("orgsConfigured", new Boolean(OrganizationUtil.areOrganizationsConfigured()));
137 140
			    request.setAttribute("skinsConfigured", new Boolean(SkinUtil.areSkinsConfigured()));
138
			    request.setAttribute("metacatConfigured", new Boolean(MetaCatUtil.isMetacatConfigured()));	
141
			    request.setAttribute("metacatConfigured", new Boolean(MetacatUtil.isMetacatConfigured()));	
139 142
			    request.setAttribute("geoserverConfigured", 
140 143
			    		PropertyService.getProperty("configutil.geoserverConfigured"));
141 144
			    request.setAttribute("metcatServletInitialized", MetaCatServlet.isFullyInitialized());
......
163 166
				// process authentication
164 167
				AuthAdmin.getInstance().configureAuth(request, response);
165 168
				return;
166
			// TODO MCD figure out if org configuration is still needed	
167
//			} else if (action.equals("organization")) {
168
//				// process organization
169
//				OrganizationAdmin.getInstance().configureOrganization(request, response);
170
//				return;
171 169
			} else if (action.equals("login")) {
172 170
				// process login
173 171
				LoginAdmin.getInstance().authenticateUser(request, response);
174 172
				return;
173
			} else if (action.equals("backup")) {
174
				// process login
175
				BackupAdmin.getInstance().configureBackup(request, response);
176
				return;
175 177
			} else if (action.equals("geoserver")) {
176 178
				// process geoserver password change
177 179
				GeoserverAdmin.getInstance().configureGeoserver(request, response);

Also available in: Unified diff