Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 96c75f5
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bbde4d4
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 6, 2011

  1. Add support for getting/setting the profile_id field

    Affects #13646: Support profile fields
    rombert committed Dec 6, 2011

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    c47e5e1 View commit details
  2. Implement mc_user_profiles_get_all

    Fixes #13646: Support profile fields
    rombert committed Dec 6, 2011

    Verified

    This commit was signed with the committer’s verified signature.
    jtojnar Jan Tojnar
    Copy the full SHA
    bbde4d4 View commit details
Showing with 141 additions and 4 deletions.
  1. +71 −4 api/soap/mantisconnect.php
  2. +1 −0 api/soap/mc_core.php
  3. +5 −0 api/soap/mc_issue_api.php
  4. +64 −0 api/soap/mc_user_profile_api.php
75 changes: 71 additions & 4 deletions api/soap/mantisconnect.php
Original file line number Diff line number Diff line change
@@ -595,12 +595,58 @@
'struct',
'all',
'',
array(
'results' => array( 'name' => 'results', 'type' => 'tns:TagDataArray', 'minOccurs' => '0' ),
'total_results' => array( 'name' => 'total_results', 'type' => 'xsd:integer', 'minOccurs' => '0' )
)
array(
'results' => array( 'name' => 'results', 'type' => 'tns:TagDataArray', 'minOccurs' => '0' ),
'total_results' => array( 'name' => 'total_results', 'type' => 'xsd:integer', 'minOccurs' => '0' )
)
);

### ProfileData
$l_oServer->wsdl->addComplexType(
'ProfileData',
'complexType',
'struct',
'all',
'',
array(
'id' => array( 'name' => 'id', 'type' => 'xsd:integer', 'minOccurs' => '0' ),
'user_id' => array( 'name' => 'user_id', 'type' => 'tns:AccountData', 'minOccurs' => '0' ),
'platform' => array( 'name' => 'platform', 'type' => 'xsd:string', 'minOccurs' => '0' ),
'os' => array( 'name' => 'os', 'type' => 'xsd:string', 'minOccurs' => '0' ),
'os_build' => array( 'name' => 'os_build', 'type' => 'xsd:string', 'minOccurs' => '0' ),
'description' => array( 'name' => 'description', 'type' => 'xsd:string', 'minOccurs' => '0' )
)
);

### ProfileDataArray
$l_oServer->wsdl->addComplexType(
'ProfileDataArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(array(
'ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:ProfileData[]'
)
),
'tns:ProfileData'
);


### ProfileDataSearchResult
$l_oServer->wsdl->addComplexType(
'ProfileDataSearchResult',
'complexType',
'struct',
'all',
'',
array(
'results' => array( 'name' => 'results', 'type' => 'tns:ProfileDataArray', 'minOccurs' => '0' ),
'total_results' => array( 'name' => 'total_results', 'type' => 'xsd:integer', 'minOccurs' => '0' )
)
);
###
### PUBLIC METHODS
###
@@ -1543,6 +1589,27 @@
'Get the value for the specified user preference.'
);

###
### PUBLIC METHODS (defined in mc_user_profile_api.php)
###


### mc_user_profiles_get_all
$l_oServer->register( 'mc_user_profiles_get_all',
array(
'username' => 'xsd:string',
'password' => 'xsd:string',
'page_number' => 'xsd:integer',
'per_page' => 'xsd:integer'
),
array(
'return' => 'tns:ProfileDataSearchResult'
),
$t_namespace,
false, false, false,
'Get profiles available to the current user.'
);

###
### PUBLIC METHODS (defined in mc_tag_api.php)
###
1 change: 1 addition & 0 deletions api/soap/mc_core.php
Original file line number Diff line number Diff line change
@@ -42,3 +42,4 @@
require_once( $t_current_dir . 'mc_custom_field_api.php' );
require_once( $t_current_dir . 'mc_user_pref_api.php' );
require_once( $t_current_dir . 'mc_tag_api.php' );
require_once( $t_current_dir . 'mc_user_profile_api.php' );
5 changes: 5 additions & 0 deletions api/soap/mc_issue_api.php
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ function mc_issue_get( $p_username, $p_password, $p_issue_id ) {
$t_issue_data['summary'] = $t_bug->summary;
$t_issue_data['version'] = mci_null_if_empty( $t_bug->version );
$t_issue_data['build'] = mci_null_if_empty( $t_bug->build );
$t_issue_data['profile_id'] = mci_null_if_empty( $t_bug->profile_id );
$t_issue_data['platform'] = mci_null_if_empty( $t_bug->platform );
$t_issue_data['os'] = mci_null_if_empty( $t_bug->os );
$t_issue_data['os_build'] = mci_null_if_empty( $t_bug->os_build );
@@ -622,6 +623,7 @@ function mc_issue_add( $p_username, $p_password, $p_issue ) {
$t_bug_data->date_submitted = isset( $p_issue['date_submitted'] ) ? $p_issue['date_submitted'] : '';
$t_bug_data->last_updated = isset( $p_issue['last_updated'] ) ? $p_issue['last_updated'] : '';
$t_bug_data->eta = $t_eta_id;
$t_bug_data->profile_id = isset ( $p_issue['profile_id'] ) ? $p_issue['profile_id'] : 0;
$t_bug_data->os = isset( $p_issue['os'] ) ? $p_issue['os'] : '';
$t_bug_data->os_build = isset( $p_issue['os_build'] ) ? $p_issue['os_build'] : '';
$t_bug_data->platform = isset( $p_issue['platform'] ) ? $p_issue['platform'] : '';
@@ -802,6 +804,8 @@ function mc_issue_update( $p_username, $p_password, $p_issue_id, $p_issue ) {
$t_bug_data->date_submitted = $p_issue['date_submitted'];
if ( isset ( $p_issue['date_updated'] ) )
$t_bug_data->last_updated = $p_issue['last_updated'];
if ( isset ( $p_issue['profile_id'] ) )
$t_bug_data->profile_id = $p_issue['profile_id'];
if ( isset ( $p_issue['os'] ) )
$t_bug_data->os = $p_issue['os'];
if ( isset ( $p_issue['os_build'] ) )
@@ -1312,6 +1316,7 @@ function mci_issue_data_as_array( $p_issue_data, $p_user_id, $p_lang ) {
$t_issue['summary'] = $p_issue_data->summary;
$t_issue['version'] = mci_null_if_empty( $p_issue_data->version );
$t_issue['build'] = mci_null_if_empty( $p_issue_data->build );
$t_issue['profile_id'] = mci_null_if_empty( $p_issue_data->profile_id );
$t_issue['platform'] = mci_null_if_empty( $p_issue_data->platform );
$t_issue['os'] = mci_null_if_empty( $p_issue_data->os );
$t_issue['os_build'] = mci_null_if_empty( $p_issue_data->os_build );
64 changes: 64 additions & 0 deletions api/soap/mc_user_profile_api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
# MantisBT - A PHP based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.

/**
* Returns all the profiles for the user, including the global ones
*
* @param string $p_username The user's username
* @param string $p_password The user's password
* @param integer $p_page_number
* @param integer $p_per_page
*
*/
function mc_user_profiles_get_all( $p_username, $p_password, $p_page_number, $p_per_page ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if ( $t_user_id === false ) {
return mci_soap_fault_login_failed();
}

if ( !mci_has_readonly_access( $t_user_id ) ) {
return mci_soap_fault_access_denied( $t_user_id );
}

$t_results = array();
$t_start = max ( array ( 0, $p_page_number - 1 ) ) * $p_per_page;

foreach ( profile_get_all_for_user( $t_user_id ) as $t_profile_row ) {

$t_result = array(
'id' => $t_profile_row['id'],
'description' => $t_profile_row['description'],
'os' => $t_profile_row['os'],
'os_build' => $t_profile_row['os_build'],
'platform' => $t_profile_row['platform']
);

if ( $t_profile_row['user_id'] != 0 )
$t_result['user_id'] = mci_account_get_array_by_id( $t_profile_row['user_id'] );

$t_results[] = $t_result;
}

// the profile_api does not implement pagination in the backend, so we emulate it here
// we can always push the pagination in the database, but this seems unlikely in the
// near future, as the number of profiles is expected to be small
$t_paged_results = array_slice ( $t_results, $t_start, $p_per_page );

return array (
'total_results' => count ( $t_results),
'results' => $t_paged_results
);
}