How to Use the SAS Java Authorization Services Interface

standard usage

Example 5: Setting the PermissionInfoInterface List for a single identity

This is an example of setting the List of PermissionInfoInterface instances for a single IdentityInterface object. Each PermissionInfoInterface instance added to the List represents the GRANT or DENY for valid Permission name. A Permission name should only be granted or denied once.

     try
     {
        MetadataInterface object;  // any Services-level MetadataInterface object type will work here (your code must fill this in)
        AuthorizationUtilInterface authUtil = object.getAuthorizationUtil();
        IdentityInterface identity;  // The IdentityInterface for which Permissions are being set.
        // GRANT ReadMetadata and DENY WriteMetdata for this Identity
        List <PermissionInfoInterface>permInfoList = new ArrayList<PermissionInfoInterface>(2);
        permInfoList.add(new PermissionInfo(
                    PermissionType.GRANT, PermissionInfoInterface.PERMISSION_READMETADATA ));
        permInfoList.add(new PermissionInfo(
                    PermissionType.DENY, PermissionInfoInterface.PERMISSION_WRITEMETADATA ));
        authUtil.setAuthorizations(Identity, permInfoList);
     }
     catch (ServiceException e)
     {
        e.printStackTrace();
     }
     catch (RemoteException e)
     {
        e.printStackTrace();
     }