options.addItem().addHighlight("bold").addXref(baseURL+"&submit_roles",T_options_roles);
options.addItem().addXref(baseURL+"&submit_harvesting",T_options_harvest);
options.addItem().addXref(baseURL+"&submit_curate",T_options_curate);
// The table of admin roles
Table rolesTable = main.addTable("roles-table", 6, 5);
Row tableRow;
// The header row
Row tableHeader = rolesTable.addRow(Row.ROLE_HEADER);
tableHeader.addCell().addContent(T_role_name);
tableHeader.addCell().addContent(T_role_group);
tableHeader.addCell().addContent(T_role_buttons);
rolesTable.addRow();
/*
* The collection admins
*/
// data row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_admins);
if (admins != null)
{
try
{
AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName());
}
catch (AuthorizeException authex) {
// add a notice, the user is not authorized to create/edit collection's admin group
tableRow.addCell().addContent(T_not_allowed);
}
try
{
AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCollection);
tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete);
}
catch (AuthorizeException authex)
{
// nothing to add, the user is not allowed to delete the group
}
}
else
{
tableRow.addCell().addContent(T_no_role);
try
{
AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
tableRow.addCell().addButton("submit_create_admin").setValue(T_create);
}
catch (AuthorizeException authex) {
// add a notice, the user is not authorized to create/edit collection's admin group
tableRow.addCell().addContent(T_not_allowed);
}
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_admins);
/*
* The collection submitters
*/
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_submitters);
try
{
AuthorizeUtil.authorizeManageSubmittersGroup(context, thisCollection);
if (submitters != null)
{
tableRow.addCell().addXref(baseURL + "&submit_edit_submit", submitters.getName());
tableRow.addCell().addButton("submit_delete_submit").setValue(T_delete);
}
else
{
tableRow.addCell().addContent(T_no_role);
tableRow.addCell().addButton("submit_create_submit").setValue(T_create);
}
}
catch (AuthorizeException authex)
{
tableRow.addCell().addContent(T_not_allowed);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_submitters);
/*
* The collection's default read authorizations
*/
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_default_read);
if (defaultRead == null)
{
// Custome reading permissions, we can't handle it, just provide a link to the
// authorizations manager.
tableRow.addCell(1,2).addContent(T_default_read_custom);
}
else if (defaultRead.getID() == Group.ANONYMOUS_ID) {
// Anonymous reading
tableRow.addCell().addContent(T_default_read_anonymous);
addAdministratorOnlyButton(tableRow.addCell(),"submit_create_default_read",T_restrict);
}
else
{
// A specific group is dedicated to reading.
tableRow.addCell().addXref(baseURL + "&submit_edit_default_read", defaultRead.getName());
addAdministratorOnlyButton(tableRow.addCell(),"submit_delete_default_read",T_delete);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_default_read);
if(ConfigurationManager.getProperty("workflow","workflow.framework").equals("xmlworkflow")){
try{
HashMap<String, Role> roles = WorkflowUtils.getAllExternalRoles(thisCollection);
addXMLWorkflowRoles(thisCollection, baseURL, roles, rolesTable);
} catch (WorkflowConfigurationException e) {
log.error(LogManager.getHeader(context, "error while getting collection roles", "Collection id: " + thisCollection.getID()));
} catch (IOException e) {
log.error(LogManager.getHeader(context, "error while getting collection roles", "Collection id: " + thisCollection.getID()));
}
}else{
addOriginalWorkflowRoles(thisCollection, baseURL, rolesTable);
}
try
{
AuthorizeUtil.authorizeManageCollectionPolicy(context, thisCollection);
// add one last link to edit the raw authorizations
Cell authCell =rolesTable.addRow().addCell(1,3);
authCell.addXref(baseURL + "&submit_authorizations", T_edit_authorization);
}
catch (AuthorizeException authex) {
// nothing to add, the user is not authorized to edit collection's policies
}