Block a user.

        Returns a `relationship dict`_ containing the updated relationship to the user.
463
def account_block(self, id):
        
        id = self.__unpack_id(id)
        url = '/api/v1/accounts/{0}/block'.format(str(id))
        return self.__api_request('POST', url)
707536
public function block($id)
    {
        $this->loadModel('User.Users');
        $user = $this->Users->get($id, [
            'fields' => ['id', 'name', 'email'],
            'contain' => ['Roles'],
        ]);

        if (!in_array(ROLE_ID_ADMINISTRATOR, $user->role_ids)) {
            if ($this->Users->updateAll(['status' => 0], ['id' => $user->id])) {
                $this->Flash->success(__d('user', 'User {0} was successfully blocked!', $user->name));
                $user->updateToken();
                NotificationManager::blocked($user)->send();
            } else {
                $this->Flash->danger(__d('user', 'User could not be blocked, please try again.'));
            }
        } else {
            $this->Flash->warning(__d('user', 'Administrator users cannot be blocked.'));
        }

        $this->title(__d('user', 'Block User Account'));
        $this->redirect($this->referer());
    }
153745
def removeUserFromRole( dbid, userid, roleid )
      @dbid, @userid, @roleid = dbid, userid, roleid 
      
      xmlRequestData = toXML( :userid, @userid )
      xmlRequestData << toXML( :roleid, @roleid )
      
      sendRequest( :removeUserFromRole, xmlRequestData )
      
      return self if @chainAPIcalls
      @requestSucceeded
   end
220352
def unblock(user)
      friendship = find_any_friendship_with(user)
      return false if friendship.nil? || !friendship.can_unblock?(self)
      friendship.update_attribute(:blocker, nil)
    end
1147468
def remove_from_group(self, group, user):
        
        data = {'group': group, 'user': user}
        return self.post('removeUserFromGroup', data)
73040
def blocks
      RelationProxy.new(self, Block, [Operations::Create, Operations::List, Operations::Delete]) do
        def from_response(response, client)
          response['url'] ||= "#{base.url}#{resource_type.url}/#{response['user_id']}"
          super
        end

        def create(attributes, client = self.client)
          response = client.post(url, attributes)
          from_response({ 'user_id' => attributes['user_id'] }, client)
        end
      end
    end
539640
def current_user():
    
    user_id = current_user_id()
    guard = current_guard()
    user = guard.user_class.identify(user_id)
    PraetorianError.require_condition(
        user is not None,
        "Could not identify the current user from the current id",
    )
    return user
456949
def delete_relationship(manager, relationship_id):
    
    q = """
        MATCH ()-[r]->()
        WHERE ID(r) = {relationship_id}
        DELETE r
        """
    with manager.session as s:
        s.run(q, {'relationship_id': int(relationship_id)})
    return True
924517
def delete_relationship(cls, id, related_collection_name, related_resource=None):
        
        try:
            this_resource = cls.nodes.get(id=id, active=True)
            if not related_resource:
                r = this_resource.delete_relationship_collection(related_collection_name)
            else:
                r = this_resource.delete_individual_relationship(related_collection_name, related_resource)
        except DoesNotExist:
            r = application_codes.error_response([application_codes.RESOURCE_NOT_FOUND])
        return r
1194058
def remove_connection(provider_id, provider_user_id):
    
    provider = get_provider_or_404(provider_id)

    ctx = dict(provider=provider.name, user=current_user,
               provider_user_id=provider_user_id)

    deleted = _datastore.delete_connection(user_id=current_user.get_id(),
                                           provider_id=provider_id,
                                           provider_user_id=provider_user_id)

    if deleted:
        after_this_request(_commit)
        msg = ('Connection to %(provider)s removed' % ctx, 'info')
        connection_removed.send(current_app._get_current_object(),
                                user=current_user._get_current_object(),
                                provider_id=provider_id)
    else:
        msg = ('Unabled to remove connection to %(provider)s' % ctx, 'error')

    do_flash(*msg)
    return redirect(request.referrer or get_post_login_redirect())
1325748
def user_related(self, id, **kwargs):
        ""
        api_path = "/api/v2/users/{id}/related.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
842598
public function removeFriendship(DataObject $relationship) {
		if ($relationship && $relationship->canDelete()) {
			
			// need to remove this user from the 'other's followers group and friends group
			// if needbe
			if ($relationship->Status == 'Approved') {
				$reciprocal = $relationship->reciprocal();
				if ($reciprocal) {
					// set it back to pending
					$reciprocal->Status = 'Pending';
					$reciprocal->write();
				}
				
				$friends = $relationship->Other()->getGroupFor(MicroBlogMember::FRIENDS);
				$relationship->Initiator()->Groups()->remove($friends);
				
				$friends = $relationship->Initiator()->getGroupFor(MicroBlogMember::FRIENDS);
				$relationship->Other()->Groups()->remove($friends);
			}
			
			$followers = $relationship->Other()->getGroupFor(MicroBlogMember::FOLLOWERS);
			$relationship->Initiator()->Groups()->remove($followers);
			
			$relationship->delete();
			return $relationship;
		}
	}
310370
def unblockUser(self, user_id):
        
        data = {"fbid": user_id}
        r = self._post(self.req_url.UNBLOCK_USER, data)
        return r.ok
42741
def only_to(self, status):
        
        from_relationships = self.get_relationships(status)
        to_relationships = self.get_related_to(status)
        return to_relationships.exclude(pk__in=from_relationships.values_list('pk'))
1269533
def _get_user(self) -> Dict:
        

        if 'callback_query' in self._update:
            return self._update['callback_query']['from']
        elif 'inline_query' in self._update:
            return self._update['inline_query']['from']
        elif 'message' in self._update:
            return self._update['message']['from']
699845
def removeFriend(user)
      method = 'removeFriend'
      type = Boolean
      args = {:user=>user}
      return_object type,method,args,true
    end
385266
public function blockFriendRequest(Model $recipient): bool
    {
        if (!$this->isFriendsWith($recipient)) {
            return false;
        }

        return (bool) $this->findFriendship($recipient)->update([
            'status' => Status::BLOCKED,
        ]);
    }