Totara Learn Open Discussions

Custom certificate plugin: overview of issued certificates is empty?

 
Marek Hanacek
Re: Custom certificate plugin: overview of issued certificates is empty?
بواسطة Wednesday, 22 May 2024, 11:33 PM - Marek Hanacek
مجموعة Partners

Hi all,

my reverse engineering lead to issue with native function $DB->get_in_or_equal()

list($sql, $params) = $DB->get_in_or_equal($certmanagers, SQL_PARAMS_NAMED, 'cert');


Input & Output from that line without assign role 'Tenant Domain Manager':
$certmanagers:
array(10) { [0]=> int(19) [1]=> int(2514) [2]=> int(1122) [3]=> int(58) [4]=> int(3) [5]=> int(18) [6]=> int(2) [7]=> int(3) [8]=> int(4) [9]=> int(1085) }

$sql:string(115) "IN (:uq_cert_1,:uq_cert_2,:uq_cert_3,:uq_cert_4,:uq_cert_5,:uq_cert_6,:uq_cert_7,:uq_cert_8,:uq_cert_9,
:uq_cert_10)"

$params:
array(10) { ["uq_cert_1"]=> int(19) ["uq_cert_2"]=> int(2514) ["uq_cert_3"]=> int(1122) ["uq_cert_4"]=> int(58) ["uq_cert_5"]=> int(3) ["uq_cert_6"]=> int(18) ["uq_cert_7"]=> int(2) ["uq_cert_8"]=> int(3) ["uq_cert_9"]=> int(4) ["uq_cert_10"]=> int(1085) }


And when we assign tenane role:

$certmanagers:
array(11) { [0]=> int(2541) [1]=> int(19) [2]=> int(2514) [3]=> int(1122) [4]=> int(58) [5]=> int(3) [6]=> int(18) [7]=> int(2) [8]=> int(3) [9]=> int(4) [10]=> int(1085) }

$sql:
string(63) "IN ('2541','19','2514','1122','58','3','18','2','3','4','1085')"

$params:
array(0) { }


Custom certificate plugin than in table view has condition that if $params is empty, do not show generate that table with issued certificates.