Process the grants removed from a node.

@param nodeName
The node name.
@param grantsToRevoke
The grants to revoke.
505256
private void handleRevokedGrants(
      String nodeName, Set<ClusterNode.GrantId> grantsToRevoke) {
    for (ClusterNode.GrantId grantId: grantsToRevoke) {
      String sessionHandle = grantId.getSessionId();

      try {
        sessionManager.revokeResource(sessionHandle,
            Collections.singletonList(grantId.getRequestId()));
      } catch (InvalidSessionHandle e) {
        // ignore
        LOG.warn("Found invalid session: " + sessionHandle +
                 " while timing out node: " + nodeName);
      }
    }
  }
1304578
public void dropRole(String name) {

        if (!isRole(name)) {
            throw Error.error(ErrorCode.X_0P000, name);
        }

        if (GranteeManager.isReserved(name)) {
            throw Error.error(ErrorCode.X_42507);
        }

        removeGrantee(name);
    }
803360
@Override
    public void deleteStoreIfPresent(String storeName) {
        String tableName = storeToCQLName(storeName);
        if (storeExists(tableName)) {
            new CQLSchemaManager(this).dropCQLTable(tableName);
        }
    }
703849
public void revoke(OrderedHashSet granteeList, SchemaObject dbObject,
                       Right rights, Grantee grantor, boolean grantOption,
                       boolean cascade) {

        if (!grantor.isFullyAccessibleByRole(dbObject)) {
            throw Error.error(ErrorCode.X_42501, dbObject.getName().name);
        }

        if (grantor.isAdmin()) {
            grantor = dbObject.getOwner();
        }

        for (int i = 0; i < granteeList.size(); i++) {
            String  name = (String) granteeList.get(i);
            Grantee g    = get(name);

            if (g == null) {
                throw Error.error(ErrorCode.X_28501, name);
            }

            if (isImmutable(name)) {
                throw Error.error(ErrorCode.X_28502, name);
            }
        }

        for (int i = 0; i < granteeList.size(); i++) {
            String  name = (String) granteeList.get(i);
            Grantee g    = get(name);

            g.revoke(dbObject, rights, grantor, grantOption);
            g.updateAllRights();

            if (g.isRole) {
                updateAllRights(g);
            }
        }
    }
808773
public void blocksBeingWrittenReport(DatanodeRegistration nodeReg,
      BlockReport blocks) throws IOException {
    verifyRequest(nodeReg);
    long[] blocksAsLong = blocks.getBlockReportInLongs();
    BlockListAsLongs blist = new BlockListAsLongs(blocksAsLong);
    boolean processed = namesystem.processBlocksBeingWrittenReport(nodeReg, blist);

    String message = "*BLOCK* NameNode.blocksBeingWrittenReport: "
        +"from "+nodeReg.getName()+" "+blist.getNumberOfBlocks() +" blocks";
    if (!processed) {
      message += " was discarded.";
    }
    stateChangeLog.info(message);
  }
210057
protected Object doInvokeMethod(String methodName, Object name, Object args) {
        super.doInvokeMethod(methodName, name, args);


        // return the completed node
        return lastCompletedNode;
    }
678780
public void addNewGrants(List<ResourceGrant> grants) {
    int numGranted = 0;
    int numAvailable = 0;
    synchronized(lockObject) {
      for (ResourceGrant grant: grants) {
        Integer requestId = grant.getId();
        if (!requestedResources.containsKey(requestId) ||
            !requestMap.containsKey(requestId)) {
          LOG.info("Request for grant " + grant.getId() + " no longer exists");
          continue;
        }
        assert !grantedResources.containsKey(grant.getId()) :
            "Grant " + grant.getId() + " has already been processed.";
        updateTrackerAddressUnprotected(grant);

        addGrantedResourceUnprotected(grant);
      }
      updateGrantStatsUnprotected();
      numGranted = grantedResources.size();
      numAvailable = availableResources.size();
      lockObject.notify();
    }
    LOG.info("Number of available grants: " + numAvailable +
        " out of " + numGranted);
  }
82242
public void setGrants(java.util.Collection<GrantListEntry> grants) {
        if (grants == null) {
            this.grants = null;
            return;
        }

        this.grants = new com.ibm.cloud.objectstorage.internal.SdkInternalList<GrantListEntry>(grants);
    }
492358
function _onChildNodeRemoved(event, res) {
        // res = {parentNodeId, nodeId}
        if (res.nodeId > 0) {
            var node = nodeWithId(res.nodeId);
            node.remove();
        }
    }
1109506
public function grant(DataObject $node, $perm, DataObject $to, $grant = 'GRANT')
    {
        // make sure we can !!
        if (!$this->checkPerm($node, 'ChangePermissions')) {
            throw new PermissionDeniedException("You do not have permission to do that");
        }

        $role = DataObject::get_one('AccessRole', '"Title" = \'' . Convert::raw2sql($perm) . '\'');

        $composedOf = array($perm);
        if ($role && $role->exists()) {
            $composedOf = $role->Composes->getValues();
        }

        $type = $to instanceof Member ? 'Member' : get_class($to);
        $filter = array(
            'Type'            => $type,
            'AuthorityID'    => $to->ID,
            'ItemID'        => $node->ID,
            'ItemType'        => $node->class,
            'Grant'            => $grant,
        );
        
        $list = DataList::create('AccessAuthority')->filter($filter);
        $existing = $list->first();
        if (!$existing || !$existing->exists()) {
            $existing = new AccessAuthority;
            $existing->Type = $type;
            $existing->AuthorityID = $to->ID;
            $existing->ItemID = $node->ID;
            $existing->ItemType = $node->class;
            $existing->Grant = $grant;
            $existing->Role = $role ? $role->Title : '';
        }

        $currentRoles = $existing->Perms->getValues();
        if (!$currentRoles) {
            $new = $composedOf;
        } else {
            $new = array_merge($currentRoles, $composedOf);
        }

        $new = array_unique($new);
        $existing->Perms = $new;
        $existing->write();

        $this->clearPermCacheFor($node);

        return $existing;
    }
949637
public void removeDatanode(DatanodeID nodeID)
    throws IOException {
    writeLock();
    try {
      DatanodeDescriptor nodeInfo = getDatanode(nodeID);
      if (nodeInfo != null) {
        removeDatanode(nodeInfo);
      } else {
        NameNode.stateChangeLog.warn("BLOCK* NameSystem.removeDatanode: "
          + nodeID.getName() + " does not exist");
      }
    } finally {
      writeUnlock();
    }
  }
1020002
private void relinquishResource(ZooKeeper zookeeper, String poolNode, int resource) {
        logger.debug("Relinquishing claimed resource {}.", resource);
        try {
            zookeeper.delete(poolNode + "/" + Integer.toString(resource), -1);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } catch (KeeperException e) {
            logger.error("Failed to remove resource claim node {}/{}", poolNode, resource);
        }
    }
1079220
void revoke(SchemaObject object, Right right, Grantee grantor,
                boolean grantOption) {

        final HsqlName name     = object.getName();
        Iterator       it       = directRightsMap.get(name);
        Right          existing = null;

        while (it.hasNext()) {
            existing = (Right) it.next();

            if (existing.grantor == grantor) {
                break;
            }
        }

        if (existing == null) {
            return;
        }

        if (existing.grantableRights != null) {
            existing.grantableRights.remove(object, right);
        }

        if (grantOption) {
            return;
        }

        if (right.isFull) {
            directRightsMap.remove(name, existing);
            grantor.grantedRightsMap.remove(name, existing);
            updateAllRights();

            return;
        }

        existing.remove(object, right);

        if (existing.isEmpty()) {
            directRightsMap.remove(name, existing);
            grantor.grantedRightsMap.remove(object, existing);
        }

        updateAllRights();

        return;
    }
177339
public function removePermissions(DataObject $node, $perm, DataObject $userOrGroup, $grant = 'GRANT')
    {
        if (!$this->checkPerm($node, 'ChangePermissions')) {
            throw new PermissionDeniedException("You do not have permission to do that");
        }

        $composedOf = $perm;
        if (!is_array($perm)) {
            $role = DataObject::get_one('AccessRole', '"Title" = \'' . Convert::raw2sql($perm) . '\'');
            $composedOf = array($perm);
            if ($role && $role->exists()) {
                $composedOf = $role->Composes->getValues();
            }
        }
        
        $type = $userOrGroup instanceof Member ? 'Member' : get_class($userOrGroup);
        $filter = array(
            'Type' => $type,
            'AuthorityID' => $userOrGroup->ID,
            'ItemID' => $node->ID,
            'ItemType' => $node->class,
            'Grant' => $grant,
        );

        $existing = DataList::create('AccessAuthority')->filter($filter)->first();
        
        if (!$existing || !$existing->exists()) {
            return;
        }

        $current = $existing->Perms->getValues();
        if (is_array($current) && count($current)) {
            $new = array_diff($current, $composedOf);
            $existing->Perms = $new;
            $existing->write();
            
            $this->clearPermCacheFor($node);
            
            if (!count($new)) {
                try {
                    $this->removeAuthority($node, $existing);
                } catch (Exception $e) {
                    // oh well
                }
            }
        }
    }
268932
private void removeStoredProjection( String externalNodeKey ) {
        SessionCache systemSession = repository.createSystemSession(repository.context(), false);
        NodeKey systemNodeKey = getSystemNode(systemSession).getKey();
        MutableCachedNode systemNode = systemSession.mutable(systemNodeKey);
        ChildReference federationNodeRef = systemNode.getChildReferences(systemSession).getChild(ModeShapeLexicon.FEDERATION);

        // if we're removing a projection, one had to be stored previously, so there should be a federation node present
        assert federationNodeRef != null;

        NodeKey federationNodeKey = federationNodeRef.getKey();
        MutableCachedNode federationNode = systemSession.mutable(federationNodeKey);
        ChildReferences federationChildRefs = federationNode.getChildReferences(systemSession);

        int projectionsCount = federationChildRefs.getChildCount(ModeShapeLexicon.PROJECTION);

        for (int i = 1; i <= projectionsCount; i++) {
            ChildReference projectionRef = federationChildRefs.getChild(ModeShapeLexicon.PROJECTION, i);
            NodeKey projectionRefKey = projectionRef.getKey();
            CachedNode storedProjection = systemSession.getNode(projectionRefKey);
            String storedProjectionExternalNodeKey = storedProjection.getProperty(ModeShapeLexicon.EXTERNAL_NODE_KEY,
                                                                                  systemSession).getFirstValue().toString();
            assert storedProjectionExternalNodeKey != null;
            if (storedProjectionExternalNodeKey.equals(externalNodeKey)) {
                federationNode.removeChild(systemSession, projectionRefKey);
                systemSession.destroy(projectionRefKey);
                systemSession.save();
                break;
            }
        }
    }
1288901
public void revoke(Grantee role) {

        if (!hasRoleDirect(role)) {
            throw Error.error(ErrorCode.X_0P503, role.getNameString());
        }

        roles.remove(role);
    }
53356
public void releaseNode(final NodeId node) throws Exception {
		Lockable<SharedBufferNode> sharedBufferNode = sharedBuffer.getEntry(node);
		if (sharedBufferNode != null) {
			if (sharedBufferNode.release()) {
				removeNode(node, sharedBufferNode.getElement());
			} else {
				sharedBuffer.upsertEntry(node, sharedBufferNode);
			}
		}
	}