Determine if the given user can delete the given team.

@param UserPolicy $user
@param Team $team

@return bool
355957
public function destroy(UserPolicy $user, Team $team)
    {
        return $team->user_id == user_id() && $team->user_type == user_type();
    }
627908
public function destroyTeam()
    {
        $response = $this->rest->post(
            static::TEAM_DESTROY_PATH
        );

        $this->checkResponse($response, false);

        return true;
    }
994584
public function destroy(UserPolicy $user, Resume $resume)
    {
        return $resume->user_id == user_id() && $resume->user_type == user_type();
    }
389952
public function hasRole($role, $team = null, $requireAll = false)
    {
        if ($user = $this->user()) {
            return $user->hasRole($role, $team, $requireAll);
        }

        return false;
    }
944972
public function prune($team = null)
    {
        if ($team) {
            $this->addUsingAlias(TeamTableMap::ID, $team->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
709113
public function manage(User $user, Job $job)
    {
        return $this->allowOnTeam($user, $job->team_id);
    }
1019649
public function deleteUser(User $user)
    {
        $parent = $user->getParent();
        if (!isset($this->userList[$user->getUsername()]) || $this->userList[$user->getUsername()] !== $user ||
            $parent == null
        ) {
            return false;
        }
        $this->connection->beginTransaction();
        $children = $this->getChildren($user);
        $success = true;
        foreach ($children as $child) {
            /** @var $child User */
            $success = $success && $child->setParent($parent);
        }
        $success = $success && $user->delete();

        if ($success) {
            $this->connection->commit();
            $this->setUpIterator();
        } else {
            $this->connection->rollBack();
        }
        return $success;
    }
1101480
public function selfUnregisterUserToTeamAction(Team $team, User $user)
    {
        $workspace = $team->getWorkspace();
        $this->checkToolAccess($workspace);

        if ($team->getSelfUnregistration()) {
            $this->teamManager->unregisterUserFromTeam($team, $user);
        }

        return new Response('success', 200);
    }
33352
public function delete(User $user, User $entity)
    {
        if ($entity->id === $user->id) {
            return true;
        }
        return $user->hasPermission('user-delete');
    }
960815
public function verify(UserPolicy $user, Task $task)
    {
        if ($user->canDo('task.task.verify') && $user->isAdmin()) {
            return true;
        }


        return false;
    }
681171
public function removeUser($userUri, core_kernel_classes_Resource $group) {
        $user = new \core_kernel_classes_Resource($userUri);
        return $user->removePropertyValue(new core_kernel_classes_Property(self::PROPERTY_MEMBERS_URI), $group);
    }
1051898
public function leaveTeam($teamId, $userId)
    {
        $team = $this->team->find($teamId);
        $user = $this->model->find($userId);

        $user->teams()->detach($team);
    }
925873
public function isOwnerOfTeam( $team )
    {
        $team_id        = $this->retrieveTeamId( $team );
        return ( $this->teams()
            ->where('owner_id', $this->getKey())
            ->where('team_id', $team_id)->first()
        ) ? true : false;
    }
1234745
public function emptyTeams(array $teams)
    {
        $this->om->startFlushSuite();

        foreach ($teams as $team) {
            $users = $team->getRole()->getUsers()->toArray();
            $this->unregisterUsersFromTeam($team, $users);
        }
        $this->om->endFlushSuite();
    }
805803
public function view(UserPolicy $user, Job $job)
    {
        if ($user->canDo('career.job.view') && $user->isAdmin()) {
            return true;
        }

        return $job->user_id == user_id() && $job->user_type == user_type();
    }
34387
public function destroy(UserPolicy $user, Portfolio $portfolio)
    {
        return $portfolio->user_id == user_id() && $portfolio->user_type == user_type();
    }
840914
public function delete()
    {
        $this->getLogger()->info('Deleting User Group ID ' . $this->groupId);
        $this->doDelete('/group/' . $this->groupId);

        return true;
    }