Totara Learn Open Discussions

Custom certificate plugin: overview of issued certificates is empty?

 
HanacekMarek
Re: Custom certificate plugin: overview of issued certificates is empty?
HanacekMarek 发表于 2024年05月22日 Wednesday 23:33
小组 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.