Project

General

Profile

« Previous | Next » 

Revision 5734

Added by berkley about 14 years ago

fixed bug where permission would get set to -1 for no good reason

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
300 300
                    } else if (params.get(FUNCTION_KEYWORD)[0].equals(FUNCTION_NAME_SET_ACCESS)) {
301 301
                        setaccess();
302 302
                        status = true;
303
                        //System.out.println("done setting access");
303
                        System.out.println("done setting access");
304 304
                    }
305 305
                } else if (resource.equals(RESOURCE_META)) {
306 306
                    System.out.println("Using resource 'meta'");
src/edu/ucsb/nceas/metacat/accesscontrol/XMLAccessAccess.java
344 344
	 */
345 345
	private void insertXMLAccess(String docId, String principalName, Long permission, String permType,
346 346
			String permOrder) throws AccessException {
347
	    //System.out.println("permission in insertXMLAccess: " + permission);
348
	    try
349
	    {
350
	        if(permission == -1)
351
	        {
352
	            throw new Exception("Permission is -1 in XMLAccessAccess.insertXMLAccess().");
353
	        }
354
	    }
355
	    catch(Exception e)
356
	    {
357
	        e.printStackTrace();
358
	        logMetacat.warn(e.getMessage());
359
	    }
360
	    
347 361
		if (docId == null) {
348 362
			throw new AccessException("XMLAccessAccess.insertXMLAccess - docid is required when " + 
349 363
					"inserting XML access record");
src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlForSingleFile.java
117 117
			// It will bitwise OR to permissions if the principal already has a record for this
118 118
			// doc id.
119 119
			XMLAccessAccess xmlAccessAccess = new XMLAccessAccess();
120
			//System.out.println("permission in accessControlForSingleFile.insertPermissions: " + permission);
120 121
			xmlAccessAccess.addXMLAccess(_docId, principalName, new Long(permission), permType, permOrder);
121 122
		} catch (AccessException ae) {
122 123
			throw new AccessControlException("AccessControlForSingleFile.insertPermissions - "
......
326 327
		for (XMLAccessDAO xmlAccessDAO : xmlAccessDAOList) {
327 328
			principal = xmlAccessDAO.getPrincipalName();
328 329
			permission = xmlAccessDAO.getPermission().intValue();
330
			//System.out.println("accessControlForSingleFile.getAccessString: permission is set to: " + permission);
329 331
			permType = xmlAccessDAO.getPermType();
330 332
			
331 333
			tmpOutput.append("    <" + permType + ">\n");
src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlList.java
635 635

  
636 636
    /* Get the int value of READ, WRITE, CHMOD or ALL. */
637 637
	public static int intValue(String permission) {
638
		int thisPermission = 0;
638
		int thisPermission = new Integer(permission).intValue();
639 639
		if (permission.toUpperCase().contains(CHMODSTRING)) {
640 640
			thisPermission |= CHMOD;
641 641
		} 
src/edu/ucsb/nceas/metacat/MetacatHandler.java
944 944
        params.put("permOrder", new String[] {permissionOrder});
945 945
        params.put("docid", new String[]{docid});
946 946
        
947
        //System.out.println("permission in MetacatHandler.setAccess: " + params.get("permission")[0]);
947 948
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
948 949
        PrintWriter out = new PrintWriter(baos);
949 950
        handleSetAccessAction(out, params, username, null, null);
950 951
        String resp = baos.toString();
951
        System.out.println("response from MetacatHandler.setAccess: " + resp);
952
        //System.out.println("response from MetacatHandler.setAccess: " + resp);
952 953
    }
953 954
    
954 955
    /** read metadata or data from Metacat
......
2702 2703
        // Only select first element for permission, type and order
2703 2704
        permission = permissionList[0];
2704 2705
        permType = permTypeList[0];
2706
        System.out.println("permission in MetacatHandler.handleSetAccessAction: " + permission);
2707
        
2705 2708
        if (permOrderList != null) {
2706 2709
            permOrder = permOrderList[0];
2707 2710
        }
......
2785 2788
                    //insert permission
2786 2789
                    AccessControlForSingleFile accessControl = 
2787 2790
                        new AccessControlForSingleFile(accessionNumber);
2791
                    Long l = new Long(permission);
2792
                    //System.out.println("permission in MetacatHandler: " + l.longValue());
2793
                    //System.out.println("permission in MetacatHandler: " + Integer.valueOf(AccessControlList.intValue(permission)).longValue());
2788 2794
                    accessControl.insertPermissions(principal, Integer.valueOf(AccessControlList.intValue(permission)).longValue(), permType, permOrder);
2789 2795
                } catch (Exception ee) {
2790 2796
                    logMetacat.error("MetaCatServlet.handleSetAccessAction - Error inserting permission: "

Also available in: Unified diff