Although Luminis IV is reported to have an improved layout manager where we will be able to add channels to a default tab that a particular group of users do not have access to and have them suppressed when they log in this ability is currently lacking in Luminis III.
As I needed this functionality I have come up with a method that allows us to do this. My method makes use of JavaScript and some AJAX to first hide the unauthroised channel and then call the typical URL(the one behind the 'X' button) to remove the channel from the user's layout.
This modification has been tested on Luminis III.3.3 and will require the modification of $CP_ROOT/webapps/luminis/stylesheets/org/jasig/portal/layout/tab-column/nested-tables/nested-tables.xsl as well as obtaining um_utils.js and um_http_request.js (which you can find in the story 'U of M JavaScript functions').
Instructions
- Backup nested-tables.xsl
- Open up nested-tables.xsl into your favorite text editor
-
We will be modifing the regularLayout (roughly line 573) and channel (roughly line 871) templates in this file
- Just below the start of the regularLayout template you will see a number of script tags for reading in various Luminis JavaScript files. You need to add the following script tags to the end of that block (modify the path to the js files as need be):
<script language="JavaScript" src="/js/um_http_request.js"></script>
<script language="JavaScript" src="/js/um_utils.js"></script>
- Scroll down into you see the body tag (roughly line 629 after the previous modification) and add to the body tag the attribute onload with the value um_remove_unauth_channels()
- Just below the start of the channel template (directly below the xsl:param element) you need to add the following HTML/XSL:
<div id="um_chan_{@ID}">
- Just before the channel template is finished(roughly line 917) you need to close the div we opened in the previous step with:
</div>
- Save nested-tables.xsl
- The system will probably pick up the change to ensted-tables.xsl at some point but to see it imemdiately you should cycle your webserver
Comments
Gone forever
Bill,
I see this will work, and you have some absolutely clever hacks here. However, there is one downfall: the deleted channel is now gone from the user's layout forever, even if they inherit the proper role that would have given them permissions to it in the future.
The benefit that **should** come with Luminis IV is that these channels will silently disappear if a user shouldn't be able to see them, but if they do become authorized to see them in the future, then the channels will properly show up the next time the user logs in.
Todd
RE: Gone forever
You are right, once it runs it is gone but not forever. If the user then gets added to the needed role the channel can come back in one of three ways (although I will say right away that none of the ways are the best expierence for the user).
a) The user can now add that channel as they now have access to it.
b) If the default layout is changed then the channel will get pushed back to them.
c) The user's layout is reset using the layout reset channel provided by Sungard.
My initial intent was to modify the XSL however there is no property in the currently produced XML that indicates what roles the user is in (at least not what I saw) as I would have preferred to suppress the channel before it is even drawn.
As for removing the channel, I did it this way (although it would be just commenting one line to change that behaviour) so that it cleans up the user's layout right away. Otherwise if you are on a slow machine with a slow connection you will always see that 'Not authorised' channel very briefly which may cause questions to come up.
If you wish to disable the deletion part of the script just comment out line 43 in the um_utils.js file. That is the line that does the actual deletion, you could also comment out lines 40 to 45 to even prevent the script from figuring out what URL to use to remove the channel.
I am really looking forward to Luminis IV as this is supposed to be resolved. This is strictly a hack to simulate the behaviour Luminis IV should bring. :)
BTW sorry for the delayed reply been quite busy the last couple of months. :)
RE: Gone forever
Excellent work, this is just what I was looking for. One note with regards to pushing the channel back after the user receives the required role - restarting Luminis seems to do the trick, I just tested this and it worked like a charm.