fastscripT实现权限控制

fastscripT权限控制

此处以FASTSCRIPT实现功能权限为例,用脚本实现数据权限也是很方便的。

unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, fs_ipascal, fs_iinterpreter, Vcl.Menus, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ToolWin;

type
TForm1 = class(TForm)
script: TfsScript;
fsPascal1: TfsPascal;
Button1: TButton;
MainMenu1: TMainMenu;
btnappend: TMenuItem;
btnsave: TMenuItem;
btndelete: TMenuItem;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses fs_iformsrtti, fs_imenusrtti;

procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
comp: TComponent;
sScript: string;
begin
sScript := 'begin form1.btnsave.enabled:=false;form1.btndelete.enabled:=false;end.';
script.Clear;
script.Parent := fsGlobalUnit;
script.AddComponent(Form1);
for i := 0 to Self.ComponentCount - 1 do
begin
comp := self.Components[i];
if comp is TMenuItem then
script.AddComponent(comp);
end;
script.Lines.Text := sScript;
if not Script.Run then
ShowMessage('script error: ' + Script.ErrorMsg);
end;

end.

 

转载于:https://www.cnblogs.com/hnxxcxg/p/6386399.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值