|
发表于 2008-7-9 11:30:50
|
显示全部楼层
组织单元的功能权限存储在其Module.RunFuncAlloc属性中。
对组织单元分配权限,就是在操作这个属性。楼主可以参考一下组织机构管理器中的代码:
Static function TASSIGNMANAGEFUNC.AssignA(AContext: TContext; AParent: TBizURL; AOrgFuncKind: TOrgFuncKind; ADeptManager: TDeptManager): Boolean;
var
I: Integer;
lOrigin, lOrg: TOrgUnit;
lItems: TOrgFuncAllocItems;
begin
lOrg := TOrgUnit.Create(AParent);
with TAssignManageFunc.Create(AContext) do
try
FDeptManager := ADeptManager;
Caption := StrUtils.IfThen(AOrgFuncKind = TOrgFuncKind.ofkManage, '分配管理功能', '分配运行功能');
FParentModule := lOrg.Module;
if AOrgFuncKind = TOrgFuncKind.ofkManage then
FItems := FParentModule.ManageFuncAlloc
else
FItems := FParentModule.RunFuncAlloc;
FOrgFuncKind := AOrgFuncKind;
InitUI;
Result := ShowModal = Business.Forms.Controls.mrOK;
if Result then
begin
Forms.Screen.Cursor := Business.Forms.Controls.crHourGlass;
try
lOrigin := OrgSys.OrgSystem.GetUnit(AParent);
if FOrgFuncKind = TOrgFuncKind.ofkManage then
lItems := lOrigin.Module.ManageFuncAlloc
else
lItems := lOrigin.Module.RunFuncAlloc;
lItems.Clear;
for I := 0 to FItems.Count - 1 do
lItems.AddItem(FItems[I].FuncURL);
OrgSys.OrgSystem.SaveUnit(lOrigin);
TCommonFunc.OrgChanged;
finally
Forms.Screen.Cursor := Business.Forms.Controls.crDefault;
end;
end;
finally
Free;
lOrg.Free;
end;
end; |
|