public Permissionable getParentPermissionable() throws DotDataException {
try {
User systemUser = APILocator.getUserAPI().getSystemUser();
FolderAPI fAPI = APILocator.getFolderAPI();
HostAPI hostAPI = APILocator.getHostAPI();
Host systemHost = hostAPI.findSystemHost(systemUser, false);
Structure st = getStructure();
if(st != null && st.getVelocityVarName() != null && st.getVelocityVarName().equals("Host")) {
Host hProxy = new Host(this);
return hProxy.getParentPermissionable();
}
// if this contentlet is being saved in a folder, inherit from the folder
if(InodeUtils.isSet(this.getFolder()) && ! "SYSTEM_FOLDER".equals(this.getFolder())) {
return fAPI.find(this.getFolder(), APILocator.getUserAPI().getSystemUser(), false);
}
// if this contentlet is being saved in a host, inherit from the host
if(InodeUtils.isSet(this.getHost()) && ! this.getHost().equals(systemHost.getIdentifier())) {
return hostAPI.find(this.getHost(), systemUser, false);