Board Logo

Does Tigra support security levels?
Tonya - 7/21/2004 at 02:40 AM

I've been looking for a portal type menu system for a while and have seriously considered the DotNetNuke system. The thing I like about it is its ability to only display menu options according to security levels assigned to users. Does Tigra have this option?


tigra - 7/21/2004 at 01:07 PM

You can do that with Tigra Menu (free/pro/gold) and additional server side code. It is not recommented to do such checks on the client side because in this case you'll need to send to client side information about menu items for all user roles which make it available for viewing (security issue).


Tonya - 7/22/2004 at 07:41 AM

I want to use an SQL database table of users and their access levels and use these levels to determine what tabs on the menu they can see and access. Any hints or examples of how this can be achieved would be really apppreciated.


tigra - 7/22/2004 at 02:24 PM

Ok, here is one simple approach:
You create separate items structure (the one that normally in menu_tiems.js) for each user role and put them as field in appropriate records in the database table containing list of the roles. In this case each user group has own items structure assigned. Once you determined what group user belongs to you just output items structure to the browser where menu is displayed.


Tonya - 7/23/2004 at 02:28 AM

Sorry to be difficult but I simply don't know how to do it. Judging from the interest in this thread there are many others out there that would like to know about this also.


tigra - 7/23/2004 at 04:29 AM

No problem with additional questions.
What part of proposed solution requires clarifications?


Tonya - 7/23/2004 at 07:00 AM

I follow what you are saying regarding the SQL tables and I can see where these may be referenced in the inc file but I don't see how. Let's say I have two users UserA and UserB. UserA has access level 1 (can see all {3} menu tabs) but UserB should only be able to see some {2} of the tabs. How do I do it?


tigra - 7/23/2004 at 03:36 PM

Ok, we can simplify that to some code like this:

var MENU_ITEMS = [
['item1', ....],
['item2', ....],
<? if ($user == 'UserA') { ?>
['item3'...]
<? } ?>
];

makes sence?


Tonya - 7/25/2004 at 11:19 PM

I follow that ok but now where do I put it? Does it go in the section of the inc file that references the part of the menu that I want to restrict? I have included below the line where I suspect it may go. If I am right can you get me started please.


tigra - 7/26/2004 at 02:50 PM

1. you can rename menu_items.js to menu_items.php or menu_items.asp and put the code in that file.
2. (recommended in this case) you can put that code in <script ..> tag in the same document. Just make sure it is above the menu initialization so MENU_ITEMS variable is available at the moment menu is being created.


icode4u - 10/15/2005 at 05:16 AM

What I do is add a security field to the database then based on what level their security is will be what menu items I show.
e.g rs.open "SELECT * FROM table WHERE security <="&session("security"), conn


LordMerlin - 6/10/2006 at 10:21 AM

How about?

Code:

var MENU_ITEMS = [
<? if ($user == $access_level) { ?>
['item1', ....],
['item2', ....],
['item3'...]
<? } ?>
];

$access level can then be a field in the MySQL DB

What is the best way of doing this?


tmh - 6/20/2006 at 10:25 PM

Can I use the following ASP coding?

var MENU_ITEMS = [
['item1', ....],
['item2', ....],
<% if Session.Contents("UserType") = "2" then %>
['item3'...]
<% end if %>
];

After that I renamed the file as menu_items.asp and replaced the line
<script language="JavaScript" src="menu.js"></script>

with this:
<!--#include file="menu_items.asp"-->

in the file that references the menu.

I can't seem to get it working though... please can anyone help me out?
Thanks a bunch... :)


tigra - 6/21/2006 at 09:09 AM

you shouldn't replace

<script language="JavaScript" src="menu.js"></script>
this:
<!--#include file="menu_items.asp"-->

you should replace
<script language="JavaScript" src="menu_items.js"></script>
with
<script language="JavaScript" src="menu_items.asp"></script>
that's in case you want to keep structure in the separate file or replace
<script language="JavaScript" src="menu_items.js"></script>
with
<script language="JavaScript">
<!--#include file="menu_items.asp"-->
</script>
if you want to move items structure inside the main document file

also in your code:

var MENU_ITEMS = [
['item2', ....], // <--- this comma
<% if Session.Contents("UserType") = "2" then %>
// <--- must be here because there shold be no comma if there are no subitems
['item3'...]
<% end if %>
];


tmh - 7/4/2006 at 08:01 PM

Thanks alot for the guidance, I've finally managed to get the menu up and working!

Just one slight thing though, whenever I mouse over and then mouse out the menu, the status bar at the bottom displays "Error on page". When I double click on it, the error message box displays as follows:

Line: 64
Char: 1
Error: Object expected
Code:0
URL:[the page URL here]

rgds,
tmh


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/