function CanAccess(AccessName: string): boolean;
var
tc: tclientdataset;
begin
flast_access_name := accessname;
result := false;
if getsqldata('select count(rightname) as cc from accessoperation ' +
' where rightname="' + accessname + '" ') = 0 then
begin
with kskdm.bcds1 do
begin
close;
data := HOSxP_GetDataset('select * from accessoperation limit 0');
append;
fieldbyname('rightname').asstring := accessname;
fieldbyname('accessname').asstring := 'Access_' + accessname;
post;
if changecount > 0 then
HOSxP_UpdateDelta(delta, 'select * from accessoperation limit 0');
close;
end;
end;
kskdm.fcds.close;
if getsqldata('select count(loginname) as cc from opduser') <= 0 then
begin
//kskdm.fcds.close;
result := true;
exit;
end;
kskdm.fcds.close;
if not FUseExProvider then
begin
if sys_db = 'MySQL' then
kskdm.fcds.data :=
hosxp_getdataset('select accessright from opduser where loginname="'
+
flgn + '"')
else
kskdm.fcds.data :=
hosxp_getdataset('select accessright from opduser where upper(loginname)="'
+
uppercase(flgn) + '"');
kskdm.fcds.open;
result := (pos(uppercase(string(accessname)),
uppercase(kskdm.fcds.fieldbyname('accessright').asstring)) > 0) or
(pos('[ADMIN]', uppercase(kskdm.fcds.fieldbyname('accessright').asstring))
>
0);
end
else
begin
tc := tclientdataset.create(nil);
tc.data :=
HOSxP_GetDataSet('select accessright from opduser where loginname=''' +
flgn + '''');
result := (pos(uppercase(string(accessname)),
uppercase(tc.fieldbyname('accessright').asstring)) > 0) or
(pos('[ADMIN]', uppercase(tc.fieldbyname('accessright').asstring)) >
0);
tc.free;
end;
//showmessage('Request -> '+AccessName+#13+
//'Compare -> '+kskdm.fcds.fieldbyname('accessright').asstring);
kskdm.fcds.close;
end;