Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phone3 deletion ; Phone3 is replaced with countryCode everywhere #1525

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion api/v1/postRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// URL: /api/v1/people
// Method: POST
// Params: userid (required)
// lastname, firstname, phone1, phone2, phone3, email, adminowndevices,
// lastname, firstname, phone1, phone2, countryCode, email, adminowndevices,
// readaccess, writeaccess, deleteaccess, contactadmin, rackrequest,
// rackadmin, siteadmin
// Returns: record as modified
Expand Down
2 changes: 1 addition & 1 deletion api/v1/putRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
// URL: /api/v1/people/:userid
// Method: PUT
// Params: userid (required, passed as :userid in URL)
// lastname, firstname, phone1, phone2, phone3, email, adminowndevices,
// lastname, firstname, phone1, phone2, countryCode, email, adminowndevices,
// readaccess, writeaccess, deleteaccess, contactadmin, rackrequest,
// rackadmin, siteadmin
// Returns: record as created
Expand Down
6 changes: 3 additions & 3 deletions bulk_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

$fieldNum = 1;

foreach ( array( "LastName"=>"The last (family) name of the user account being imported.", "FirstName"=>"The first (given) name of the user account being imported.", "UserID"=>"The UserID, as returned by the authentication mechanism (apache, LDAP, etc), of the user account being imported. Required unique.", "Email"=>"Email address of the user account being imported. Required.", "Phone1"=>"A phone number for contacting the person.", "Phone2"=>"A phone number for contacting the person.", "Phone3"=>"A phone number for contacting the person.", "AdminOwnDevices"=>"Y/Yes/1 means true that the user has the ability to read/write/delete any devices owned by a department they are a member of.", "ReadAccess"=>"Y/Yes/1 means true that the user has global read access in the system.", "WriteAccess"=>"Y/Yes/1 means true that the user has global write/enter/modify access in the system.", "DeleteAccess"=>"Y/Yes/1 means true that the user has global delete access within the system.", "ContactAdmin"=>"Y/Yes/1 means true that the user has rights to enter and modify the user accounts of others in the system.", "RackRequest"=>"Y/Yes/1 means true that the user is allowed to enter Rack Requests in the system.", "RackAdmin"=>"Y/Yes/1 means true that the user is allowed to process/complete rack requests in the system.", "SiteAdmin"=>"Y/Yes/1 means true that the user has the ability to perform upgrades to the openDCIM installation, and to modify infrastructure such as cabinets, data centers, and power distribution.", "BulkOperations"=>"Y/Yes/1 means true that the user has the ability to access the Bulk Importer functions within openDCIM.", "DepartmentMembership"=>"Optional, comma separated list of departments to add the UserID to. Will not remove from any departments absent in the list during an update." ) as $fieldName=>$helpText ) {
foreach ( array( "LastName"=>"The last (family) name of the user account being imported.", "FirstName"=>"The first (given) name of the user account being imported.", "UserID"=>"The UserID, as returned by the authentication mechanism (apache, LDAP, etc), of the user account being imported. Required unique.", "Email"=>"Email address of the user account being imported. Required.", "Phone1"=>"A phone number for contacting the person.", "Phone2"=>"A phone number for contacting the person.", "countryCode"=>"Country code of the person.", "AdminOwnDevices"=>"Y/Yes/1 means true that the user has the ability to read/write/delete any devices owned by a department they are a member of.", "ReadAccess"=>"Y/Yes/1 means true that the user has global read access in the system.", "WriteAccess"=>"Y/Yes/1 means true that the user has global write/enter/modify access in the system.", "DeleteAccess"=>"Y/Yes/1 means true that the user has global delete access within the system.", "ContactAdmin"=>"Y/Yes/1 means true that the user has rights to enter and modify the user accounts of others in the system.", "RackRequest"=>"Y/Yes/1 means true that the user is allowed to enter Rack Requests in the system.", "RackAdmin"=>"Y/Yes/1 means true that the user is allowed to process/complete rack requests in the system.", "SiteAdmin"=>"Y/Yes/1 means true that the user has the ability to perform upgrades to the openDCIM installation, and to modify infrastructure such as cabinets, data centers, and power distribution.", "BulkOperations"=>"Y/Yes/1 means true that the user has the ability to access the Bulk Importer functions within openDCIM.", "DepartmentMembership"=>"Optional, comma separated list of departments to add the UserID to. Will not remove from any departments absent in the list during an update." ) as $fieldName=>$helpText ) {
$content .= '<div>
<div><span title="' . __($helpText) . '">' . __($fieldName) . '</span>: </div><div><select name="' . $fieldName . '">';
for ( $n = 0; $n < sizeof( $fieldList ); $n++ ) {
Expand Down Expand Up @@ -124,7 +124,7 @@

// Also make sure we start with an empty string to display
$content = "";
$fields = array( "LastName", "FirstName", "UserID", "Email", "Phone1", "Phone2", "Phone3", "AdminOwnDevices", "ReadAccess", "WriteAccess", "DeleteAccess", "ContactAdmin", "RackRequest", "RackAdmin", "SiteAdmin", "BulkOperations", "DepartmentMembership" );
$fields = array( "LastName", "FirstName", "UserID", "Email", "Phone1", "Phone2", "countryCode", "AdminOwnDevices", "ReadAccess", "WriteAccess", "DeleteAccess", "ContactAdmin", "RackRequest", "RackAdmin", "SiteAdmin", "BulkOperations", "DepartmentMembership" );

$iPerson = new People();
$trueArray = array( "1", "Y", "YES" );
Expand Down Expand Up @@ -153,7 +153,7 @@
$iPerson->Email = $row["Email"];
$iPerson->Phone1 = $row["Phone1"];
$iPerson->Phone2 = $row["Phone2"];
$iPerson->Phone3 = $row["Phone3"];
$iPerson->countryCode = $row["countryCode"];
$iPerson->AdminOwnDevices = in_array( strtoupper($row["AdminOwnDevices"]), $trueArray );
$iPerson->ReadAccess = in_array( strtoupper($row["ReadAccess"]), $trueArray );
$iPerson->WriteAccess = in_array( strtoupper($row["WriteAccess"]), $trueArray );
Expand Down
12 changes: 6 additions & 6 deletions login_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ function debug_error_log($stuff) {
// GetPersonByUserID just populated our person object, update it with the
// info we just pulled from ldap, if they are a valid user we'll update the
// db version of their name below, suppress any errors for missing attributes
@$person->FirstName=$ldapResults[0][$config->ParameterArray['AttrFirstName']][0];
@$person->LastName =$ldapResults[0][$config->ParameterArray['AttrLastName']][0];
@$person->Email =$ldapResults[0][$config->ParameterArray['AttrEmail']][0];
@$person->Phone1 =$ldapResults[0][$config->ParameterArray['AttrPhone1']][0];
@$person->Phone2 =$ldapResults[0][$config->ParameterArray['AttrPhone2']][0];
@$person->Phone3 =$ldapResults[0][$config->ParameterArray['AttrPhone3']][0];
@$person->FirstName =$ldapResults[0][$config->ParameterArray['AttrFirstName']][0];
@$person->LastName =$ldapResults[0][$config->ParameterArray['AttrLastName']][0];
@$person->Email =$ldapResults[0][$config->ParameterArray['AttrEmail']][0];
@$person->Phone1 =$ldapResults[0][$config->ParameterArray['AttrPhone1']][0];
@$person->Phone2 =$ldapResults[0][$config->ParameterArray['AttrPhone2']][0];
@$person->countryCode =$ldapResults[0][$config->ParameterArray['AttrCountry']][0];

if($config->ParameterArray['LDAPSiteAccess']=="" || isUserInLDAPGroup($config, $ldapConn, $config->ParameterArray['LDAPSiteAccess'], $ldapUser)){
// No specific group membership required to access openDCIM or they have a match to the group required
Expand Down
4 changes: 2 additions & 2 deletions login_oidc.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
if ( $config->ParameterArray["AttrPhone2"] != "" )
$person->Phone2 = $oidc->requestUserInfo($config->ParameterArray["AttrPhone2"]);

if ( $config->ParameterArray["AttrPhone3"] != "" )
$person->Phone3 = $oidc->requestUserInfo($config->ParameterArray["AttrPhone3"]);
if ( $config->ParameterArray["AttrCountry"] != "" )
$person->countryCode = $oidc->requestUserInfo($config->ParameterArray["AttrCountry"]);

// If an attribute name for 'Groups' is specified, use it to override rights. Otherwise, leave existing accounts alone.
if ( $config->ParameterArray["SAMLGroupAttribute"] != "" ) {
Expand Down
4 changes: 2 additions & 2 deletions report_contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function SetLegends($data, $format)

$pdf->SetFont( $config->ParameterArray['PDFfont'], '', 8 );

$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("Phone3"), __("Email") );
$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("countryCode"), __("Email") );
$cellWidths = array( 50, 20, 25, 25, 25, 50 );
$maxval = count( $headerTags );
for ( $col = 0; $col < $maxval; $col++ )
Expand All @@ -465,7 +465,7 @@ function SetLegends($data, $format)
$pdf->Cell( $cellWidths[1], 6, $contact->UserID, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[2], 6, $contact->Phone1, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[3], 6, $contact->Phone2, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->Phone3, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->countryCode, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[5], 6, $contact->Email, 'LBRT', 1, 'L', $fill );

$fill =! $fill;
Expand Down
4 changes: 2 additions & 2 deletions report_cost.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ function SetLegends($data, $format)

$pdf->SetFont( $config->ParameterArray["PDFfont"], "", 8 );

$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("Phone3"), __("Email") );
$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("countryCode"), __("Email") );
$cellWidths = array( 50, 20, 25, 25, 25, 50 );
for ( $col = 0; $col < count( $headerTags ); $col++ )
$pdf->Cell( $cellWidths[$col], 7, $headerTags[$col], 1, 0, "C", 1 );
Expand All @@ -448,7 +448,7 @@ function SetLegends($data, $format)
$pdf->Cell( $cellWidths[1], 6, $contact->UserID, "LBRT", 0, "L", $fill );
$pdf->Cell( $cellWidths[2], 6, $contact->Phone1, "LBRT", 0, "L", $fill );
$pdf->Cell( $cellWidths[3], 6, $contact->Phone2, "LBRT", 0, "L", $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->Phone3, "LBRT", 0, "L", $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->countryCode, "LBRT", 0, "L", $fill );
$pdf->Cell( $cellWidths[5], 6, $contact->Email, "LBRT", 1, "L", $fill );

$fill =! $fill;
Expand Down
4 changes: 2 additions & 2 deletions report_department.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function _putcatalog()

$pdf->SetFont( $config->ParameterArray['PDFfont'], '', 8 );

$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("Phone3"), __("Email") );
$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("countryCode"), __("Email") );
$cellWidths = array( 50, 20, 25, 25, 25, 50 );
$maxval = count( $headerTags );
for ( $col = 0; $col < $maxval; $col++ )
Expand All @@ -193,7 +193,7 @@ function _putcatalog()
$pdf->Cell( $cellWidths[1], 6, $contact->UserID, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[2], 6, $contact->Phone1, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[3], 6, $contact->Phone2, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->Phone3, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->countryCode, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[5], 6, $contact->Email, 'LBRT', 1, 'L', $fill );

$fill =! $fill;
Expand Down
4 changes: 2 additions & 2 deletions report_vm_by_department.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function _putcatalog()

$pdf->SetFont( $config->ParameterArray['PDFfont'], '', 8 );

$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("Phone3"), __("Email") );
$headerTags = array( __("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("countryCode"), __("Email") );
$cellWidths = array( 50, 20, 25, 25, 25, 50 );
$maxval = count( $headerTags );

Expand All @@ -238,7 +238,7 @@ function _putcatalog()
$pdf->Cell( $cellWidths[1], 6, $contact->UserID, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[2], 6, $contact->Phone1, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[3], 6, $contact->Phone2, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->Phone3, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[4], 6, $contact->countryCode, 'LBRT', 0, 'L', $fill );
$pdf->Cell( $cellWidths[5], 6, $contact->Email, 'LBRT', 1, 'L', $fill );

$fill =! $fill;
Expand Down
4 changes: 2 additions & 2 deletions saml/acs.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
if ( $config->ParameterArray["AttrPhone2"] != "" )
$person->Phone2 = $attributes[$config->ParameterArray["AttrPhone2"]][0];

if ( $config->ParameterArray["AttrPhone3"] != "" )
$person->Phone3 = $attributes[$config->ParameterArray["AttrPhone3"]][0];
if ( $config->ParameterArray["AttrCountry"] != "" )
$person->countryCode = $attributes[$config->ParameterArray["AttrCountry"]][0];

if ( $config->ParameterArray["SAMLGroupAttribute"] != "" ) {
$person->revokeAll();
Expand Down