Give you a verbose analysis of the permissions.
@param permissions the permissions value of a PDF file
@return a String that explains the meaning of the permissions value
554526
public static String getPermissionsVerbose(int permissions) {
    	StringBuffer buf = new StringBuffer("Allowed:");
    	if ((PdfWriter.ALLOW_PRINTING & permissions) == PdfWriter.ALLOW_PRINTING) buf.append(" Printing");
        if ((PdfWriter.ALLOW_MODIFY_CONTENTS & permissions) == PdfWriter.ALLOW_MODIFY_CONTENTS) buf.append(" Modify contents");
        if ((PdfWriter.ALLOW_COPY & permissions) == PdfWriter.ALLOW_COPY) buf.append(" Copy");
        if ((PdfWriter.ALLOW_MODIFY_ANNOTATIONS & permissions) == PdfWriter.ALLOW_MODIFY_ANNOTATIONS) buf.append(" Modify annotations");
        if ((PdfWriter.ALLOW_FILL_IN & permissions) == PdfWriter.ALLOW_FILL_IN) buf.append(" Fill in");
        if ((PdfWriter.ALLOW_SCREENREADERS & permissions) == PdfWriter.ALLOW_SCREENREADERS) buf.append(" Screen readers");
        if ((PdfWriter.ALLOW_ASSEMBLY & permissions) == PdfWriter.ALLOW_ASSEMBLY) buf.append(" Assembly");
        if ((PdfWriter.ALLOW_DEGRADED_PRINTING & permissions) == PdfWriter.ALLOW_DEGRADED_PRINTING) buf.append(" Degraded printing");
        return buf.toString();
    }
894709
public boolean getReadAccess(String userId) {
    if (StringUtil.isEmpty(userId)) {
      return false;
    }
    Permissions permissions = permissionsById.get(userId);
    return permissions != null && permissions.getReadPermission();
  }
1222238
@Override
	public boolean checkPermission(Permission permission)
	{
		if (permission == null)
			return false;

		boolean authorized = false;
		for (Permission accessPermission : permissions)
		{
			if(accessPermission.isAuthorized(permission))
			{
				authorized = true;
				break;
			}
		}
		
		if(negative)
			return !authorized;
		else
			return authorized;
	}
11326
public function getPermissionsAttribute($permissions)
	{
		if ( ! $permissions)
		{
			return array();
		}

		if (is_array($permissions))
		{
			return $permissions;
		}

		if ( ! $_permissions = json_decode($permissions, true))
		{
			throw new \InvalidArgumentException("Cannot JSON decode permissions [$permissions].");
		}

		return $_permissions;
	}
366697
protected function _buildPermissionsArgument()
    {
        $permissions = $this->_Pdf->permissions();

        if ($permissions === false) {
            return false;
        }

        $allowed = [];

        if ($permissions === true) {
            $allowed[] = 'AllFeatures';
        }

        if (is_array($permissions)) {
            foreach ($permissions as $permission) {
                $allowed[] = $this->_permissionsMap[$permission];
            }
        }

        return implode(' ', $allowed);
    }
1093467
public function sanitizePermissionsValue($permissions, $revision)
    {
        if (is_array($permissions)) {
            $legacyOptions = ['print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32];
            foreach ($permissions as $key => $value) {
                if (isset($legacyOptions[$value])) {
                    $permissions[$key] = $legacyOptions[$value];
                } elseif (!is_int($value)) {
                    throw new \InvalidArgumentException(
                        sprintf('Invalid permission value: %s', $value)
                    );
                }
            }

            $permissions = array_sum($permissions);
        }

        $permissions = (int)$permissions;

        $allowed = self::PERM_PRINT
            | self::PERM_MODIFY
            | self::PERM_COPY
            | self::PERM_ANNOT;

        if ($revision > 2) {
            $allowed |= self::PERM_FILL_FORM
                | self::PERM_ACCESSIBILITY
                | self::PERM_ASSEMBLE
                | self::PERM_DIGITAL_PRINT;
        }

        if (($allowed & $permissions) !== $permissions) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Permission flags (%s) are not allowed for this security handler revision %s.',
                    $permissions,
                    $revision
                )
            );
        }

        $permissions = 61632 | 0xFFFF0000 | $permissions;
        if ($revision < 3) {
            // 3840 = bit 9 to 12 to 1 - we are < revision 3
            $permissions |= 3840;
        }

        // PDF integer are 32 bit integers. Ensure this.
        if (PHP_INT_SIZE === 4 || ($permissions) < (2147483647)) {
            return $permissions;
        }

        return ($permissions | (4294967295 << 32));
    }
981234
public static String permissions(Path path) {
        try {
            return permissions(getUnixMode(path));
        } catch (IOException e) {
            throw Exceptions.propagate(e);
        }
    }
1080312
@Override
    public void addPermissions(final Collection<String> permissions) {
        CommonHelper.assertNotNull("permissions", permissions);
        this.permissions.addAll(permissions);
    }
1345371
def get_permissions_mode(permission_octal, name):
    """"""
    read = PERMISSIONS[name]['read']
    write = PERMISSIONS[name]['write']
    execute = PERMISSIONS[name]['execute']

    # Read
    if permission_octal == 4:
        return read & ~write & ~execute

    # Write
    elif permission_octal == 2:
        return ~read & write & ~execute

    # Execute
    elif permission_octal == 1:
        return ~read & ~write & execute

    # Read & Write
    elif permission_octal == 6:
        return read & write & ~execute

    # Read & Execute
    elif permission_octal == 5:
        return read & ~write & execute

    # Write & Execute
    elif permission_octal == 3:
        return ~read & write & execute

    # Read, Write & Execute
    elif permission_octal == 7:
        return read & write & execute

    # No read, write or execute by default
    else:
        return ~read & ~write & ~execute
1194620
public static function CompilePermissions($Permissions) {
      $Compiled = array();
      foreach ($Permissions as $i => $Row) {
         $JunctionID = array_key_exists('JunctionID', $Row) ? $Row['JunctionID'] : null;
         //$JunctionTable = array_key_exists('JunctionColumn', $Row) ? $Row['JunctionTable'] : null;
         //$JunctionColumn = array_key_exists('JunctionColumn', $Row) ? $Row['JunctionColumn'] : null;
         unset($Row['JunctionColumn'], $Row['JunctionColumn'], $Row['JunctionID'], $Row['RoleID'], $Row['PermissionID']);
         
         foreach ($Row as $PermissionName => $Value) {
            if ($Value == 0)
               continue;
            
            if (is_numeric($JunctionID) && $JunctionID !== NULL) {
               if (!array_key_exists($PermissionName, $Compiled))
                  $Compiled[$PermissionName] = array();
                  
               if (!is_array($Compiled[$PermissionName]))
                  $Compiled[$PermissionName] = array();
                  
               $Compiled[$PermissionName][] = $JunctionID;
            } else {
               $Compiled[] = $PermissionName;
            }
         }
      }
      
      return $Compiled;
   }
111686
private static boolean hasSelfPermissions(Context context, String... permissions) {
    for (String permission : permissions) {
      if (checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED) {
        return true;
      }
    }
    return false;
  }
772642
public static function getPermissionWithAndWithoutWildcards($permissions)
    {
        $wildcard = [];
        $noWildcard = [];

        foreach ($permissions as $permission) {
            if (strpos($permission, '*') === false) {
                $noWildcard[] = $permission;
            } else {
                $wildcard[] = str_replace('*', '%', $permission);
            }
        }

        return [$wildcard, $noWildcard];
    }
401711
public function permissions($permissions = null)
    {
        if (!$this->protect()) {
            return $this;
        }

        if ($permissions === null) {
            return $this->_allow;
        }

        if (is_string($permissions) && $permissions == 'all') {
            $permissions = true;
        }

        if (is_string($permissions) && $permissions == 'none') {
            $permissions = false;
        }

        if (is_array($permissions)) {
            foreach ($permissions as $permission) {
                if (!in_array($permission, $this->_availablePermissions)) {
                    throw new Exception(sprintf('Invalid permission: %s', $permission));
                }

                if (!$this->crypto()->permissionImplemented($permission)) {
                    throw new Exception(sprintf('Permission not implemented in crypto engine: %s', $permission));
                }
            }
        }

        $this->_allow = $permissions;

        return $this;
    }
1060502
private boolean checkPermission(String permission) {
        int res = ctx.checkCallingOrSelfPermission(permission);
        return (res == PackageManager.PERMISSION_GRANTED);
    }
348
@Override @NonNull @CheckReturnValue public Observable<Permission> requestEach(@NonNull final String... permissions) {
    return Observable.just(TRIGGER)
        .compose(ensureEach(permissions));
  }
1255426
private void printDestinationPermissions(Map<String, ?> destinationPermissions) {
        Set<String> destinations = destinationPermissions.keySet();
        for (String destination : destinations) {
            SibTr.debug(tc, CLASS_NAME + " Destination: " + destination);
            Permission permission = (Permission) destinationPermissions.get(destination);
            SibTr.debug(tc, "  Users having permissions!!!");
            Map<String, Set<String>> userRoles = permission.getRoleToUserMap();
            Set<String> uRoles = userRoles.keySet();
            for (String role : uRoles) {
                SibTr.debug(tc, "    " + role + ": " + userRoles.get(role));
            }
            SibTr.debug(tc, "  Groups having permissions!!!");
            Map<String, Set<String>> groupRoles = permission
                            .getRoleToGroupMap();
            Set<String> gRoles = groupRoles.keySet();
            for (String role : gRoles) {
                SibTr.debug(tc, "    " + role + ": " + groupRoles.get(role));
            }
        }
    }
875041
public static boolean hasPermission(Permission permission) {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            try {
                security.checkPermission(permission);
            } catch (java.security.AccessControlException e) {
                return false;
            }
        }
        return true;
    }