日期:2014-05-16  浏览次数:20477 次

通过修改数据库的方式新建策略模板


由于在api中找不到该方法,然后通过实验得出以下实现方式:



0、通过api新建group

...



1、新建一个策略
insert into dbo.ASPolicy (pol_id,pol_options,pol_disable,pol_user_implicit,pol_net_implicit,pol_m_time,pol_c_time)
values(0xAE22239D4A63ED45997B55B421E02D51,'515',0,2,1,'2009-02-10 13:43:36.000','2009-02-10 13:42:59.000')

说明:其他字段不需要填,新建时,只需修改id和时间
======================================================
2、新建一个模版,并将上面的策略导入
insert into dbo.ASPolicyTemplate (ptm_id,ptm_policy_id,ptm_name,ptm_desc,ptm_expire_type,ptm_relative_type,ptm_relative_limit,ptm_owner)
values(0x4E25151845ED124EAC7DB1D024722E17,0xAE22239D4A63ED45997B55B421E02D51,'template2','test',0,0,0,0x1C31B647495BFC4FBE25E44588A050E8)

说明:ptm_id为模板id,ptm_policy_id为上面新建的策略的id,ptm_owner为该模板owner的id
==================================
3、将组加入到模版中
insert into dbo.ASPolicyUserOrGroupLink (pug_policy_id,pug_usr_or_grp_id,pug_permission,pug_order)
values(0xAE22239D4A63ED45997B55B421E02D51,0x5DF4F908F82E694E8C2EA78364A549E1,1,0)

说明:将id为0x5DF4F908F82E694E8C2EA78364A549E1的组加到id为0xAE22239D4A63ED45997B55B421E02D51的策略模板中,最后的pug_order要递增。