/** * add single role rights * * @param int $_roleId * @param int $_applicationId * @param string $_right */ public function addSingleRight($_roleId, $_applicationId, $_right) { // check if already in $select = $this->_roleRightsTable->select(); $select->where($this->_db->quoteInto($this->_db->quoteIdentifier('role_id') . ' = ?', $_roleId))->where($this->_db->quoteInto($this->_db->quoteIdentifier('right') . ' = ?', $_right))->where($this->_db->quoteInto($this->_db->quoteIdentifier('application_id') . ' = ?', $_applicationId)); if (!($row = $this->_roleRightsTable->fetchRow($select))) { $data = array('role_id' => $_roleId, 'application_id' => $_applicationId, 'right' => $_right); $this->_roleRightsTable->insert($data); } }
/** * Get multiple groups * * @param string|array $_ids Ids * @return Tinebase_Record_RecordSet * * @todo this should return the container_id, too */ public function getMultiple($_ids) { $result = new Tinebase_Record_RecordSet('Tinebase_Model_Group'); if (!empty($_ids)) { $select = $this->groupsTable->select(); $select->where($this->_db->quoteIdentifier('id') . ' IN (?)', array_unique((array) $_ids)); $rows = $this->groupsTable->fetchAll($select); foreach ($rows as $row) { $result->addRecord(new Tinebase_Model_Group($row->toArray(), TRUE)); } } return $result; }
/** * get prefered extension of this account * * @param int $_accountId the id of the account to get the prefered extension for * @return array * @throws Phone_Exception_NotFound */ public function getPreferedExtension($_accountId) { $accountId = Tinebase_Model_User::convertUserIdToInt($_accountId); $extensionsTable = new Tinebase_Db_Table(array('name' => SQL_TABLE_PREFIX . 'phone_extensions')); $select = $extensionsTable->select()->where($this->_db->quoteIdentifier('account_id') . ' = ?', $accountId); $row = $extensionsTable->fetchRow($select); if ($row === NULL) { throw new Phone_Exception_NotFound('No prefered extension found.'); } return $row->toArray(); }