Project

General

Profile

Revision 4766

Added by daigle almost 12 years ago

Do not back up password properties

View differences:

src/edu/ucsb/nceas/metacat/service/PropertyService.java
41 41
import edu.ucsb.nceas.metacat.util.UtilException;
42 42
import edu.ucsb.nceas.utilities.FileUtil;
43 43
import edu.ucsb.nceas.utilities.GeneralPropertyException;
44
import edu.ucsb.nceas.utilities.MetaDataProperty;
44 45
import edu.ucsb.nceas.utilities.PropertiesMetaData;
45 46
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
46 47
import edu.ucsb.nceas.utilities.SortedProperties;
......
364 365
			// Populate the backup properties for main metacat properties using
365 366
			// the associated metadata file
366 367
			PropertiesMetaData mainMetadata = new PropertiesMetaData(propertiesMetaDataFilePath);
367
			Set<String> mainKeySet = mainMetadata.getKeys();
368

  
369
			Map<String, MetaDataProperty> mainKeyMap = mainMetadata.getProperties();
370
			Set<String> mainKeySet = mainKeyMap.keySet();
368 371
			for (String propertyKey : mainKeySet) {
369
				backupProperties.addProperty(propertyKey, getProperty(propertyKey));
372
				// don't backup passwords
373
				MetaDataProperty metaData = mainKeyMap.get(propertyKey);
374
				if (!metaData.getFieldType().equals(MetaDataProperty.PASSWORD_TYPE)) {
375
					backupProperties.addProperty(propertyKey, getProperty(propertyKey));
376
				}
370 377
			}
371 378
			
372 379
			// store the properties to file
......
399 406
			// Populate the backup properties for auth properties using
400 407
			// the associated metadata file
401 408
			PropertiesMetaData authMetadata = new PropertiesMetaData(authMetaDataFilePath);
402

  
403
			Set<String> authKeySet = authMetadata.getKeys();
409
			
410
			Map<String, MetaDataProperty> authKeyMap = authMetadata.getProperties();
411
			Set<String> authKeySet = authKeyMap.keySet();
404 412
			for (String propertyKey : authKeySet) {
405
				backupProperties.addProperty(propertyKey, getProperty(propertyKey));
413
				// don't backup passwords
414
				MetaDataProperty metaData = authKeyMap.get(propertyKey);
415
				if (!metaData.getFieldType().equals(MetaDataProperty.PASSWORD_TYPE)) {
416
					backupProperties.addProperty(propertyKey, getProperty(propertyKey));
417
				}
406 418
			}
407 419
			
408 420
			// store the properties to file
src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java
29 29

  
30 30
import java.io.IOException;
31 31
import java.util.HashMap;
32
import java.util.Map;
32 33
import java.util.Set;
33 34
import java.util.Vector;
34 35

  
......
42 43
import edu.ucsb.nceas.metacat.util.UtilException;
43 44
import edu.ucsb.nceas.utilities.FileUtil;
44 45
import edu.ucsb.nceas.utilities.GeneralPropertyException;
46
import edu.ucsb.nceas.utilities.MetaDataProperty;
45 47
import edu.ucsb.nceas.utilities.PropertiesMetaData;
46 48
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
47 49
import edu.ucsb.nceas.utilities.SortedProperties;
......
390 392

  
391 393
			// Populate the backup properties for main metacat properties using
392 394
			// the associated metadata file
393
			PropertiesMetaData mainMetadata = new PropertiesMetaData(metaDataFilePath);
394
			Set<String> mainKeySet = mainMetadata.getKeys();
395
			for (String propertyKey : mainKeySet) {
396
				backupProperties.addProperty(propertyKey, getProperty(skinName,
397
						propertyKey));
398
			}
395
			PropertiesMetaData skinMetadata = new PropertiesMetaData(metaDataFilePath);
396
			
397
			Map<String, MetaDataProperty> skinKeyMap = skinMetadata.getProperties();
398
			Set<String> skinKeySet = skinKeyMap.keySet();
399
			for (String propertyKey : skinKeySet) {
400
				// don't backup passwords
401
				MetaDataProperty metaData = skinKeyMap.get(propertyKey);
402
				if (!metaData.getFieldType().equals(MetaDataProperty.PASSWORD_TYPE)) {
403
					backupProperties.addProperty(propertyKey, getProperty(skinName, propertyKey));
404
				}
405
			}			
399 406

  
400 407
			// store the properties to file
401 408
			backupProperties.store();
src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java
206 206
							skinMetaData.getProperties().get(metaDataKey);
207 207
						String fieldType = metaDataProperty.getFieldType();
208 208
						String newValue = request.getParameter(skinName + "." + metaDataKey);
209
						if (fieldType != null && fieldType.equals("checkbox")) {
209
						if (fieldType != null && fieldType.equals(MetaDataProperty.CHECKBOX_TYPE)) {
210 210
							if (newValue != null && newValue.equals("on")) {
211 211
								SkinPropertyService.checkAndSetProperty("true", skinName, metaDataKey);
212 212
							} else {

Also available in: Unified diff