VBAjedi
|
Posted: 10/07/2003, 4:34 PM |
|
I'm brand new at this, so this may be easy:
Current scenario: Users of all levels log in, and all have access to four or five viewable-grid pages via the links in the header. I've got that working.
What I want: When users click on a link named "Admin" which I have placed in the header, check that their access priviledges are sufficient, then take them to a second set/tier of editable-grid pages which use a different header (to move around in the pages of that set).
I think I have created a second header page (I just inserted a new page and pasted in the HTML from the CCS-generated header page, then edited the links in that HTML). I also have the second-tier pages created (just the CCS-generated edit grid pages). But I can't get them to display my second header instead of the default one (I went into the HTML and substituted "adminheader" for "header", but it doesn't appear in the published page). Attempting to directly view the header from a browser takes me (as best as I can describe) to a directory-view page showing the components of my custom header.
1) How do I check the current user's access priviledges when the "Admin" link is clicked?
2) How do I create a second header (something isn't right with my attempt!)?
3) How do I include this second header on the pages in my second tier?
Those questions seem so general. . . but I don't know how to be more specific!
Thanks for any help you can offer!
VBAjedi
|
|
|
ryan
|
Posted: 10/08/2003, 12:51 AM |
|
First make a login page set the security on Project Settings peoperly
Then create a page that will check for Session("GroupID") CCS already put this into a function called CCGetGroupID()
I visualize your roles as
4--------------admin
3--------------supervisor
2--------------manager
1--------------user
(check higher level inclusive of lower levels)
So SELECT CASE CCGetGroupID()
CASE "4" : 'admin
CASE "3" : 'supervisor
CASE "2" : 'manager
CASE "1" : 'user
END SELECT
Creating headers you then create a custom function inside common.asp
Function HeaderBasedRole(roleid)
SELECT CASE roleid
CASE "4" : 'admin
'delete user....change report.....print....delete record
CASE "3" : 'supervisor
'....change report.....print....delete record
CASE "2" : 'manager
'....change report.....print....
CASE "1" : 'user
'....view report.....print....
END SELECT
END Function
Then call this function on your GRID/RECORD PAGE
{HeaderBasedRole}
Set it on before show event of GRID or RECORD
HTMLTemplate.Setvar "@HeaderBasedRole",HeaderBasedRole(CCGetGroupID())
I dunno what you need next?
|
|
|
VBAjedi
|
Posted: 10/09/2003, 11:35 AM |
|
Ryan, thanks for the reply (titled "n-levels")! It's taking me some time to work through it. . . I got the CCGetGroupID thing working. Now I'm trying to bumble my way through writing/using the RoleBasedHeader custom function. Do you have a simple example with the actual code (instead of the pseudo-code in the last line of your example below) used to create each link:
Function HeaderBasedRole(roleid)
SELECT CASE roleid
CASE "4" : 'admin
'delete user....change report.....print....delete record
Thanks again,
VBAjedi
|
|
|
ryan
|
Posted: 10/09/2003, 4:16 PM |
|
arrowgance@yahoo.com
|
|
|
Ashiff
|
Posted: 10/10/2003, 10:25 AM |
|
Hi,
I have the answer exactly for you. It worked great for me.
Say your project is in c:\project directory. create c:\project\admin directory and using application builder make a new website. Now create a admin link in c:\project\header.ccp to point to c:\project\admin\default.ccp (any page you might want) and in c:\project\admin\header.ccp make a go back link and link it to c:\project\default.ccp.
Now both the sites (c:\project and c:\project\admin) must be made with the same authentication table in the same way. If the person visiting the site clicks admin then his header changes and when he goes back he gets back his old header.
if he doesn't have enough rights then he gets login page. It worked. Forget the programming and simply create the site.
|
|
|
VBAjedi
|
Posted: 10/10/2003, 10:45 AM |
|
Ashiff,
Thank you for the suggestion. In this case I want to learn the code approach (I want to become "CCSjedi" !), but I could see using your method for slightly different reasons in the future.
Ryan,
The file's in the mail. . .
|
|
|
|