Project

General

Profile

« Previous | Next » 

Revision 6722

for "all" permission, return a list of READ, WRITE, CHANGE_PERMISSION

View differences:

src/edu/ucsb/nceas/metacat/IdentifierManager.java
1230 1230
        		accessDAO.setPrincipalName(subject.getValue());
1231 1231
    			accessDAO.setGuid(guid);
1232 1232
    			accessDAO.setPermType(AccessControlInterface.ALLOW);
1233
    			accessDAO.setPermOrder(AccessControlInterface.DENYFIRST);
1233
    			accessDAO.setPermOrder(AccessControlInterface.ALLOWFIRST);
1234 1234
    			for (Permission permission: permissions) {
1235 1235
    				Long metacatPermission = new Long(convertPermission(permission));
1236 1236
        			accessDAO.addPermission(metacatPermission);
......
1262 1262
        
1263 1263
        for (XMLAccessDAO accessDAO: accessDAOs) {
1264 1264
        	AccessRule accessRule = new AccessRule();    	
1265
        	Permission permission = convertPermission(accessDAO.getPermission().intValue());
1266
        	accessRule.addPermission(permission);
1265
        	List <Permission> permissions = convertPermission(accessDAO.getPermission().intValue());
1266
        	accessRule.setPermissionList(permissions);
1267 1267
        	Subject subject = new Subject();
1268 1268
        	subject.setValue(accessDAO.getPrincipalName());
1269 1269
        	accessRule.addSubject(subject);
......
1288 1288
        
1289 1289
        for (XMLAccessDAO accessDAO: accessDAOs) {
1290 1290
        	AccessRule accessRule = new AccessRule();    	
1291
        	Permission permission = convertPermission(accessDAO.getPermission().intValue());
1292
        	accessRule.addPermission(permission);
1291
        	List <Permission> permissions = convertPermission(accessDAO.getPermission().intValue());
1292
        	accessRule.setPermissionList(permissions);
1293 1293
        	Subject subject = new Subject();
1294 1294
        	subject.setValue(accessDAO.getPrincipalName());
1295 1295
        	accessRule.addSubject(subject);
......
1311 1311
		return -1;
1312 1312
    }
1313 1313
    
1314
    public Permission convertPermission(int permission) {
1314
    public List<Permission> convertPermission(int permission) {
1315
    	List<Permission> permissions = new ArrayList<Permission>();
1315 1316
    	if (permission == AccessControlInterface.READ) {
1316
    		return Permission.READ;
1317
    		permissions.add(Permission.READ);
1318
    		return permissions;
1317 1319
    	}
1318 1320
    	if (permission == AccessControlInterface.WRITE) {
1319
    		return Permission.WRITE;
1321
    		permissions.add(Permission.WRITE);
1322
    		return permissions;
1320 1323
    	}
1321 1324
    	if (permission == AccessControlInterface.CHMOD) {
1322
    		return Permission.CHANGE_PERMISSION;
1325
    		permissions.add(Permission.CHANGE_PERMISSION);
1326
    		return permissions;
1323 1327
    	}
1324 1328
    	if (permission == AccessControlInterface.ALL) {
1325
    		return Permission.CHANGE_PERMISSION;
1329
    		permissions.add(Permission.READ);
1330
    		permissions.add(Permission.WRITE);
1331
    		permissions.add(Permission.CHANGE_PERMISSION);
1332
    		return permissions;
1326 1333
    	}
1327 1334
		return null;
1328 1335
    }

Also available in: Unified diff