Skip to content
Snippets Groups Projects
Commit f7643d99 authored by srosse's avatar srosse
Browse files

OO-1033: add edit links to the owners (but without author's role) of a resource

parent ebe6d81b
No related branches found
No related tags found
No related merge requests found
...@@ -547,11 +547,9 @@ public class RepositoryDetailsController extends BasicController implements Gene ...@@ -547,11 +547,9 @@ public class RepositoryDetailsController extends BasicController implements Gene
boolean canCopy = repositoryEntry.getCanCopy(); boolean canCopy = repositoryEntry.getCanCopy();
if (isOwner) { if (isOwner) {
if (isNewController) { if (isNewController) {
if(isAuthor) { detailsToolC.addLink(ACTION_EDIT, translate("details.openeditor"), TOOL_EDIT, null, "o_sel_repo_open_editor", false);
detailsToolC.addLink(ACTION_EDIT, translate("details.openeditor"), TOOL_EDIT, null, "o_sel_repo_open_editor", false); detailsToolC.addLink(ACTION_EDITDESC, translate("details.chdesc"), TOOL_CHDESC, null, "o_sel_repo_edit_descritpion", false);
detailsToolC.addLink(ACTION_EDITDESC, translate("details.chdesc"), TOOL_CHDESC, null, "o_sel_repo_edit_descritpion", false); detailsToolC.addLink(ACTION_EDITPROP, translate("details.chprop"), TOOL_CHPROP, null, "o_sel_repor_edit_properties", false);
detailsToolC.addLink(ACTION_EDITPROP, translate("details.chprop"), TOOL_CHPROP, null, "o_sel_repor_edit_properties", false);
}
detailsToolC.addLink(ACTION_ADD_CATALOG, translate("details.catadd"), TOOL_CATALOG, null, "o_sel_repo_add_to_catalog", false); detailsToolC.addLink(ACTION_ADD_CATALOG, translate("details.catadd"), TOOL_CATALOG, null, "o_sel_repo_add_to_catalog", false);
detailsToolC.addHeader(translate("table.action")); detailsToolC.addHeader(translate("table.action"));
...@@ -596,12 +594,10 @@ public class RepositoryDetailsController extends BasicController implements Gene ...@@ -596,12 +594,10 @@ public class RepositoryDetailsController extends BasicController implements Gene
} }
// enable // enable
if(isAuthor) { boolean editManaged = RepositoryEntryManagedFlag.isManaged(repositoryEntry, RepositoryEntryManagedFlag.editcontent);
boolean editManaged = RepositoryEntryManagedFlag.isManaged(repositoryEntry, RepositoryEntryManagedFlag.editcontent); detailsToolC.setEnabled(TOOL_EDIT, handler.supportsEdit(repositoryEntry) && !corrupted && !editManaged);
detailsToolC.setEnabled(TOOL_EDIT, handler.supportsEdit(repositoryEntry) && !corrupted && !editManaged); detailsToolC.setEnabled(TOOL_CHDESC, !corrupted);
detailsToolC.setEnabled(TOOL_CHDESC, !corrupted); detailsToolC.setEnabled(TOOL_CHPROP, !corrupted);
detailsToolC.setEnabled(TOOL_CHPROP, !corrupted);
}
canCopy = true; canCopy = true;
} }
...@@ -626,7 +622,7 @@ public class RepositoryDetailsController extends BasicController implements Gene ...@@ -626,7 +622,7 @@ public class RepositoryDetailsController extends BasicController implements Gene
if (repositoryEntry != null) { if (repositoryEntry != null) {
// The controller has already a repository-entry => do de-register it // The controller has already a repository-entry => do de-register it
CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, repositoryEntry); CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, repositoryEntry);
} }
repositoryEntry = entry; repositoryEntry = entry;
CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, ureq.getIdentity(), repositoryEntry); CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, ureq.getIdentity(), repositoryEntry);
checkSecurity(ureq); checkSecurity(ureq);
...@@ -778,7 +774,9 @@ public class RepositoryDetailsController extends BasicController implements Gene ...@@ -778,7 +774,9 @@ public class RepositoryDetailsController extends BasicController implements Gene
* @param contentController * @param contentController
*/ */
private void doEditSettings(UserRequest ureq, Controller contentController, String title) { private void doEditSettings(UserRequest ureq, Controller contentController, String title) {
if (!isAuthor) throw new OLATSecurityException("Trying to edit properties , but user is not author: user = " + ureq.getIdentity()); if (!isAuthor && !isOwner) {
throw new OLATSecurityException("Trying to edit properties , but user is not author: user = " + ureq.getIdentity());
}
Component component = contentController.getInitialComponent(); Component component = contentController.getInitialComponent();
...@@ -1188,7 +1186,7 @@ public class RepositoryDetailsController extends BasicController implements Gene ...@@ -1188,7 +1186,7 @@ public class RepositoryDetailsController extends BasicController implements Gene
* @return * @return
*/ */
public ToolController getDetailsToolController() { public ToolController getDetailsToolController() {
return this.detailsToolC; return detailsToolC;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment