Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
Is there is any way from loadFromFile or customization where I can delete the ACL
Solved! Go to Solution.
I don't think there is loadFromFile directive to delete ACL. When I had to cleanup, a lot of ACLS I used the below method. I am not sure whether this is a PTC supported method, but it did the job.
public static void deleteACLRule(String type,String stateN,String groupName) {
// String type = "wt.doc.WTDocument";
WTGroup wtgroup = null;
State state = null;
try {
@SuppressWarnings("deprecation")
// String groupName ="teamMembers";
String container_path = "/wt.inf.container.OrgContainer=Demo Organization/wt.pdmlink.PDMLinkProduct=Drive System";
WTContainerRef containerRef = WTContainerHelper.service.getByPath(container_path);
wt.query.QuerySpec qsGrp = new wt.query.QuerySpec( wt.org.WTGroup.class);
qsGrp.appendWhere(new SearchCondition(wt.org.WTGroup.class, wt.org.WTGroup.NAME , SearchCondition.EQUAL,groupName), null);
QueryResult qGpResult = PersistenceHelper.manager.find((StatementSpec)qsGrp);
System.out.println("Groups found : " + qGpResult.size());
while (qGpResult.hasMoreElements()) {
wtgroup = (WTGroup)qGpResult.nextElement();
if (wtgroup.getContainerPath().toString().equals(container_path))
{
System.out.println(wtgroup.getName() + " " +wtgroup.getContainerPath());
System.out.println("Begin Delete");
System.out.println(containerRef.getContainer().getDefaultDomainReference().getName() + "...." + type + " ..." + stateN + "..." + wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup).getDisplayName());
if(!stateN.equals("ALL"))
{
state = State.toState(stateN);
AccessControlHelper.manager.deleteAccessControlRule(containerRef.getContainer().getDefaultDomainReference(), type, state, wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup), false);
}
else
{
AccessControlHelper.manager.deleteAccessControlRule(containerRef.getContainer().getDefaultDomainReference(), type, null, wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup), false);
}
System.out.println("Delete Complete");
}
if(qGpResult.size() == 0) {
System.out.println("No Group Found with Name " + groupName);
}
}
}
catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Regards
Binesh Kumar
I don't think there is loadFromFile directive to delete ACL. When I had to cleanup, a lot of ACLS I used the below method. I am not sure whether this is a PTC supported method, but it did the job.
public static void deleteACLRule(String type,String stateN,String groupName) {
// String type = "wt.doc.WTDocument";
WTGroup wtgroup = null;
State state = null;
try {
@SuppressWarnings("deprecation")
// String groupName ="teamMembers";
String container_path = "/wt.inf.container.OrgContainer=Demo Organization/wt.pdmlink.PDMLinkProduct=Drive System";
WTContainerRef containerRef = WTContainerHelper.service.getByPath(container_path);
wt.query.QuerySpec qsGrp = new wt.query.QuerySpec( wt.org.WTGroup.class);
qsGrp.appendWhere(new SearchCondition(wt.org.WTGroup.class, wt.org.WTGroup.NAME , SearchCondition.EQUAL,groupName), null);
QueryResult qGpResult = PersistenceHelper.manager.find((StatementSpec)qsGrp);
System.out.println("Groups found : " + qGpResult.size());
while (qGpResult.hasMoreElements()) {
wtgroup = (WTGroup)qGpResult.nextElement();
if (wtgroup.getContainerPath().toString().equals(container_path))
{
System.out.println(wtgroup.getName() + " " +wtgroup.getContainerPath());
System.out.println("Begin Delete");
System.out.println(containerRef.getContainer().getDefaultDomainReference().getName() + "...." + type + " ..." + stateN + "..." + wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup).getDisplayName());
if(!stateN.equals("ALL"))
{
state = State.toState(stateN);
AccessControlHelper.manager.deleteAccessControlRule(containerRef.getContainer().getDefaultDomainReference(), type, state, wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup), false);
}
else
{
AccessControlHelper.manager.deleteAccessControlRule(containerRef.getContainer().getDefaultDomainReference(), type, null, wt.org.WTPrincipalReference.newWTPrincipalReference(wtgroup), false);
}
System.out.println("Delete Complete");
}
if(qGpResult.size() == 0) {
System.out.println("No Group Found with Name " + groupName);
}
}
}
catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Regards
Binesh Kumar