Browse Source

Some tweaks for systemtagmanager

tags/v9.1.0beta1
Vincent Petry 8 years ago
parent
commit
8fbb63d316
No account linked to committer's email address

+ 1
- 4
lib/private/SystemTag/SystemTagManager.php View File

use OCP\IUserManager; use OCP\IUserManager;
use OCP\IGroupManager; use OCP\IGroupManager;
use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTag;
use OCP\UserNotFoundException;
use OCP\IUser; use OCP\IUser;


/** /**
$this->connection->rollback(); $this->connection->rollback();
throw $e; throw $e;
} }

return false;
} }


/** /**
public function getTagGroups(ISystemTag $tag) { public function getTagGroups(ISystemTag $tag) {
$groupIds = []; $groupIds = [];
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
$query->select('*')
$query->select('gid')
->from(self::TAG_GROUP_TABLE) ->from(self::TAG_GROUP_TABLE)
->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId()))) ->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId())))
->orderBy('gid'); ->orderBy('gid');

+ 1
- 1
lib/public/SystemTag/ISystemTagManager.php View File

* @param ISystemTag $tag tag to check permission for * @param ISystemTag $tag tag to check permission for
* @param IUser $user user to check permission for * @param IUser $user user to check permission for
* *
* @return true if the user is allowed to assign/unassign the tag, false otherwise
* @return true if the user can see the tag, false otherwise
* *
* @since 9.1.0 * @since 9.1.0
*/ */

+ 0
- 62
lib/public/UserNotFoundException.php View File

<?php
/**
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

namespace OCP;

/**
* Exception when a user was not found
*
* @since 9.1.0
*/
class UserNotFoundException extends \RuntimeException {

/**
* User id that was not found
*
* @var string
*/
private $userId;

/**
* UserNotFoundException constructor.
*
* @param string $message message
* @param int $code error code
* @param \Exception $previous previous exception
* @param string $userId user id
*
* @since 9.1.0
*/
public function __construct($message = '', $code = 0, \Exception $previous = null, $userId = null) {
parent::__construct($message, $code, $previous);
$this->userId = $userId;
}

/**
* Returns the user id that was not found
*
* @return string
* @since 9.1.0
*/
public function getUserId() {
return $this->userId;
}
}

Loading…
Cancel
Save