Returns all permissions for a given user

@param \Greggilbert\Redoubt\User\UserInterface $user
@return mixed
184263
protected function getPermissionsByUser(User\UserInterface $user)
	{
		// get the user's direct permissions
		$userPerms = $this->userObjectPermission->findByUser($user);
		
		// get the permissions associated to the user's groups
		$groupPerms = $this->groupObjectPermission->findByGroups($user->getGroups());
		
		// merge the two results and return
		return $userPerms->merge($groupPerms);
	}
956210
private function doResetAdminRights(User $user)
    {
        $acl = $this->ACLProvider->get($user);
        $databoxes = $this->appbox->get_databoxes();

        $acl->give_access_to_sbas(array_map(function (\databox $databox) {
            return $databox->get_sbas_id();
        }, $databoxes));

        foreach ($databoxes as $databox) {
            $this->doResetAdminRightsOnDatabox($acl, $databox);
        }
    }
891787
public function get_user_permission($user)
	{
		$db =  \App::get('db');
		$quoted_project_id = $db->quote($this->id);

		if ($user == "anonymous")
		{
			$user = '0';
		}
		$quoted_user = $db->quote($user);
		if (is_numeric($user))
		{
			$query = "SELECT action FROM `#__trac_user_permission` AS up WHERE up.trac_project_id=$quoted_project_id AND up.user_id=$quoted_user;";
		}
		else
		{
			$query = "SELECT action FROM `#__trac_user_permission` AS up, `#__users` AS u WHERE up.trac_project_id=$quoted_project_id AND u.id=up.user_id AND u.username=$quoted_user;";
		}

		$db->setQuery($query);
		$result = $db->loadColumn();

		return $result;
	}
942099
public function grantAccessByRoles($roles, UserInterface $user = null)
    {
        $user = $user ? : $this->currentUser();
        return count(array_diff($roles, $user->getRoles())) === 0;
    }
1369074
protected function getUserId(UserInterface $user)
    {
        $class = $this->container->getParameter('tree_house.keystone.model.user.class');
        $meta = $this->getDoctrine()->getManagerForClass($class)->getClassMetadata($class);

        $ids = $meta->getIdentifierValues($user);
        if (sizeof($ids) === 1) {
            return current($ids);
        }

        return $ids;
    }
425733
public function userCan($permission, $object, $user = null)
	{
		// if no user is specified, default to the Auth one
		if(is_null($user))
		{
			$user = app('auth')->user();
		}
		
		$adminGroups = $this->groupProvider()->findAdminGroups();
		
		if($adminGroups->count() > 0 && $user->inGroup($adminGroups))
			return true;
		
		// find the exact permission for the object
		$permObject = $this->permission->findByPermissionAndObject($permission, $object);
		
		// if the permission object doesn't exist, then they don't have access
		if(!$permObject)
			return false;
		
		// if the user has direct permission, allow
		$uop = $this->userObjectPermission->findPermission($user, $object, $permObject);
		
		if($uop)
			return true;
		
		// get all the groups that have that specific permission on the object
		$gop = $this->groupObjectPermission->findPermissions($object, $permObject);
		
		// if there are no groups, deny
		if(count($gop) == 0)
			return false;
		
		// get all the relevant groups
		$groups = array();
		foreach($gop as $onePermission)
		{
			$groups[] = $onePermission->getGroup();
		}
		
		// allow or deny based on whether the user is in those groups
		return $user->inGroup($groups);
	}
361846
public function getSettingsByUser($user)
    {
        $userId = $user;
        $userEntity = null;
        if ($user instanceof EntityInterface) {
            $userId = $user->getId();
            $userEntity = $user;
        }
        if (isset($this->settingsByUser[$userId])) {
            return $this->settingsByUser[$user];
        }
        if (empty($userEntity)) {
            $UserRepository = $this->getUserRepository();
            $userEntity = $UserRepository->find($userId);
        }
        
        if (isset($userEntity)) {
            $settingsData = $userEntity->getSettings();
            $this->settingsByUser[$userId] = new SettingsEntity($this);
            $this->settingsByUser[$userId]->setData($settingsData)->spawnAsEntities();
            return $this->settingsByUser[$userId];
        }
        return null;
    }
1105704
public function getPermissions(User $user, array $resourceIds) {
        
        $results = array();
        foreach ($this->getInner() as $impl) {
            $results[] = $impl->getPermissions($user, $resourceIds);
        }
        
        $rights = array();
        foreach ($resourceIds as $id) {
            $intersect = null;
            foreach ($results as $modelResult) {
                $intersect = is_null($intersect)
                    ? $modelResult[$id]
                    : array_intersect($intersect, $modelResult[$id]);
            }
            $rights[$id] = array_values($intersect);
        }
        
        return $rights;
    }
66663
public function setOwner(UserInterface $user)
    {
        $this->_owner = UserSecurityIdentity::fromAccount($user);

        return $this->getContentInstance();
    }
1237308
public function revokeAccess($object, UserInterface $user, $permission = Permissions::PERMISSIONS_VIEW)
    {
        $objectIdentity = $this->getObjectIdentity($object);
        try {
            $acl = $this->aclProvider->findAcl($objectIdentity);
        } catch (AclNotFoundException $e) {
            // nothing to do
            return $this;
        }

        $securityIdentity = UserSecurityIdentity::fromAccount($user);
        $mask = $this->getMask($permission);

        foreach ($acl->getObjectAces() as $i => $ace) {
            /** @var EntryInterface $ace */
            if ($securityIdentity->equals($ace->getSecurityIdentity())) {
                $this->revokeMask($i, $acl, $ace, $mask);
            }
        }

        $this->aclProvider->updateAcl($acl);

        return $this;
    }
534340
private function listUserAuthorizedCollections(User $user)
    {
        $acl = $this->getAclForUser($user);
        $rights = $acl->get_bas_rights();
        $bases = $acl->get_granted_base();

        $grants = [];

        $statusMapper = new RestrictedStatusExtractor($acl, $this->getApplicationBox());

        foreach ($bases as $base) {
            $baseGrants = [];

            foreach ($rights as $right) {
                if (!$acl->has_right_on_base($base->get_base_id(), $right)) {
                    continue;
                }

                $baseGrants[] = $right;
            }

            $grants[] = [
                'databox_id'    => $base->get_sbas_id(),
                'base_id'       => $base->get_base_id(),
                'collection_id' => $base->get_coll_id(),
                'name'          => $base->get_name(),
                'logo'          => $base->get_binary_minilogos() ? base64_encode($base->get_binary_minilogos()) : '',
                'labels'        => [
                    'fr' => $base->get_label('fr'),
                    'en' => $base->get_label('en'),
                    'de' => $base->get_label('de'),
                    'nl' => $base->get_label('nl'),
                ],
                'rights'        => $baseGrants,
                'statuses'      => $statusMapper->getRestrictedStatuses($base->get_base_id())
            ];
        }

        return $grants;
    }
770916
public function authorize(UserInterface $user, $ip = null)
    {
        return $this->authRoles($user) && $this->authIps($ip);
    }
731210
protected function getUserThrottles(UserInterface $user)
    {
        $key = $user->getUserId();

        if (! array_key_exists($key, $this->userThrottles)) {
            $this->userThrottles[$key] = $this->loadUserThrottles($user);
        }

        return $this->userThrottles[$key];
    }
449998
public function getCoins(UserInterface $user)
    {
        $class = $this->getGameOptions()->getEntityAccountClass();
        $accEntityManager = $this->getAccountEntityManager();

        /** @var \GameBackend\Entity\Metin\Account\Repository\Account $repoAccount */
        $repoAccount = $accEntityManager->getRepository($class);
        $metinUser = $repoAccount->getUser($user);

        $result = 0;
        if ($metinUser) {
            $result = $metinUser->getCash();
        }

        return $result;
    }
52759
public function deletePermissionForUser($user, ...$permission)
    {
        $params = [];

        $params[] = $user;
        foreach ($permission as $perm) {
            $params[] = $perm;
        }

        return $this->removePolicy(...$params);
    }
254082
private function getEmail(UserInterface $user)
    {
        if (null !== $user->getEmail()) {
            return $user->getEmail();
        }

        return $this->container->getParameter('sulu_admin.email');
    }
1242591
public function getUserPermissions()
    {
        $permissions = $this->getPermissions();

        if (!$this->isOwner()) {
            foreach (self::$ownerPermissions as $permission) {
                $key = array_search($permission, $permissions, true);
                if (false !== $key) {
                    unset($permissions[$key]);
                }
            }
        }

        return $permissions;
    }