private void calculateVisibility() {
if (!visibilityCalculated) {
visibilityCalculated = true;
try {
SectionPermission editSectionPerm = SectionPermission.newInstance(getWorkspace(), SectionPermission.ACTION_EDIT);
setEditable(UserStatus.lookup().hasPermission(editSectionPerm));
if (isEditable()) {
setExpandible(true);
} else { //Will be expandible if I can edit any section
Section[] allSections = ((WorkspaceImpl) getWorkspace()).getAllUnsortedSections();
for (int i = 0; i < allSections.length; i++) {
Section s = allSections[i];
SectionPermission editPerm = SectionPermission.newInstance(s, SectionPermission.ACTION_EDIT);
if (UserStatus.lookup().hasPermission(editPerm)) {
setExpandible(true);
break;
}
}