Skip to content

Commit

Permalink
SAK-32127 If making the Resources tool invisible, hide root (sakaipro…
Browse files Browse the repository at this point in the history
…ject#3811)

* SAKAI-32127 If making the Resources tool invisible, hide root

Hiding the page the resources tool is on now sets the root collection
to hidden but users still able to access.

This behavior is allowed by setting the sakai.property
    poh.resources.hidden.special.hidden
to true. The default for this property is false.

* SAK-32127 elfinder now drops users into root of site

elfinder now drops users into the root of a site, instead of into
the resources folder of the site. Changes to builder.js where made
to be compatible with npm 4.0.5.

* SAK-32127 Add Atachments respects Special Hidden

Add Attachments, from Assignments / Forums, now respects when the
siteCollection (aka the root resources folder of a site) is special
hidden (hidden, but contents accessible). This is done by logging the
PermissionException which occurs and continuing.

* SAK-32127 Minor improvements

Minor improvements as a result of code review.
  • Loading branch information
master-bob authored and jonespm committed Feb 14, 2017
1 parent c74a11f commit ef3642c
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,11 @@
# DEFAULT: true
# poh.allow.lock=false

# SAK-32127
# If making the Resources tool Hidden, subsequently make the Resources root content "Hidden but Accessible"
# DEFAULT: false
# poh.resources.content.sync.visibility = true

## PODCAST
# Configurable toolId for Resources tool check
# DEFAULT: sakai.resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ protected String buildSelectAttachmentContext(VelocityPortlet portlet, Context c
}
catch(PermissionException ex)
{
logger.warn("ResourcesAction.buildSelectAttachment (static) : PermissionException.");
throw ex;
// May occurs when user attempts to access siteCollection which is hidden, with contents accessible
logger.info("ResourcesAction.buildSelectAttachment (static) : PermissionException.");
}

Set<String> expandedCollections = getExpandedCollections(toolSession);
Expand All @@ -647,7 +647,7 @@ protected String buildSelectAttachmentContext(VelocityPortlet portlet, Context c

ContentResourceFilter filter = (ContentResourceFilter) state.getAttribute(STATE_ATTACHMENT_FILTER);

List<ListItem> this_site = new Vector<ListItem>();
List<ListItem> this_site = new Vector<>();

if(contentService.isInDropbox(collectionId))
{
Expand Down Expand Up @@ -710,28 +710,30 @@ else if(contentService.isDropboxMaintainer())
}
else
{
ContentCollection collection = contentService.getCollection(collectionId);
ListItem item = ListItem.getListItem(collection, null, registry, expandAll, expandedCollections, null, null, 0, null, false, filter);
List<ListItem> items = item.convert2list();
if(filter != null)
{
items = filterList(items, filter);
}
//Check if the ListItem in 'items' matches with the attach_item in the new_items list , if yes then it should not have option to be selected.
for(Object new_item : new_items){
for(ListItem listItem : items){
if(listItem.getId().equals(((AttachItem)new_item).getId())){
listItem.setCanSelect(false);
break;
}
if(contentService.allowGetCollection(collectionId)) {
ContentCollection collection = contentService.getCollection(collectionId);
ListItem item = ListItem.getListItem(collection, null, registry, expandAll, expandedCollections, null, null, 0, null, false, filter);
List<ListItem> items = item.convert2list();
if (filter != null) {
items = filterList(items, filter);
}
//Check if the ListItem in 'items' matches with the attach_item in the new_items list , if yes then it should not have option to be selected.
for (Object new_item : new_items) {
for (ListItem listItem : items) {
if (listItem.getId().equals(((AttachItem) new_item).getId())) {
listItem.setCanSelect(false);
break;
}

}
}
this_site.addAll(items);
}
this_site.addAll(items);
}

if(!this_site.isEmpty()) {
context.put("this_site", this_site);
}

context.put ("this_site", this_site);

boolean show_all_sites = false;

Expand Down
8 changes: 4 additions & 4 deletions reference/library/src/webapp/editor/elfinder/sakai/builder.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var compressor = require('node-minify');

// Compress scripts to js/build.min.js
new compressor.minify({
type: 'uglifyjs',
fileIn: [
compressor.minify({
compressor: 'uglifyjs',
input: [
'js/sakai.js',
'js/query.js',
'js/tools.js',
Expand All @@ -15,7 +15,7 @@ new compressor.minify({
'js/i18n.js',
'js/init.js'
],
fileOut: 'js/build.min.js',
output: 'js/build.min.js',
callback: function(err){
if (!err) {
console.log("Build successful");
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (startDir) {
startDir = startDir.split('/');
startDir = startDir.filter(function(elem) { return elem; });
startDir = startDir.slice(1);
startDir = '/' + startDir.join('/') + '/content/';
startDir = '/' + startDir.join('/');

// Hashing
startDir = btoa(startDir);
Expand Down
4 changes: 4 additions & 0 deletions site-manage/pageorder/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.sakaiproject.sitemanage</groupId>
<artifactId>sakai-site-manage-util</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Loading

0 comments on commit ef3642c

Please sign in to comment.