如何通过 JAVA Security API 来定性 IBM FileNet P8 内容查询和存储的安全
2009-11-05 00:00:00 来源:WEB开发网清单 3. 使用 Security Policy 登录
// 创建 security templates
VersioningSecurityTemplate vst1 =
Factory.VersioningSecurityTemplate.createInstance(os);
VersioningSecurityTemplate vst2 =
Factory.VersioningSecurityTemplate.createInstance(os);
ApplicationSecurityTemplate vst3 =
Factory.ApplicationSecurityTemplate.createInstance(os);
SecurityTemplateList stl = Factory.SecurityTemplate.createList();
vst1.set_ApplyStateID(VersionStatusId.RELEASED);
vst1.set_TemplatePermissions(
setPermissions("#AUTHENTICATED-USERS", AccessLevel.MAJOR_VERSION_DOCUMENT.getValue()) );
vst1.set_DisplayName("Version Template for Released Object");
vst1.set_IsEnabled(Boolean.TRUE);
stl.add(vst1);
vst2.set_ApplyStateID(VersionStatusId.SUPERSEDED);
vst2.set_TemplatePermissions(
setPermissions("#AUTHENTICATED-USERS", AccessLevel.VIEW.getValue()) );
vst2.set_DisplayName("Version Template for Superseded Object");
vst2.set_IsEnabled(Boolean.TRUE);
stl.add(vst2);
vst3.set_ApplyStateID(newId("{21a47705-d20a-4b65-938e-2ddcefa45927}") );
vst3.set_TemplatePermissions( setPermissions("#AUTHENTICATED-USERS",
AccessLevel.READ.getValue()+ AccessRight.DELETE_AS_INT ) );
vst3.set_DisplayName("Application Template for Obsolete Objects");
vst3.set_IsEnabled(Boolean.TRUE);
stl.add(vst3);
// 创建 security policy
SecurityPolicy sp =
Factory.SecurityPolicy.createInstance(os, ClassNames.SECURITY_POLICY);
sp.set_SecurityTemplates(stl);
sp.set_DisplayName("Security Policy with Version and Application Templates");
sp.set_PreserveDirectPermissions(Boolean.FALSE);
sp.save(RefreshMode.REFRESH);
更多精彩
赞助商链接