This topic is locked

Hidding Some Add fields if your not the admin

1/15/2007 10:35:33 PM
ASPRunnerPro General questions
P
paulthelegend author

Ok so already i'm nearly finished my project (one day into it, i love you guys haha)
I have an add and edit section which has 5 fields at the end that i only want the admin to be able to add/view/edit
Can i hard code in some custom code that says something like
-----------

If $userid <> AdminName Then

Print <!-- (or /)
put the 5 fields in the middle
If $userid <> AdminName Then

Print --> (or
/)
-----------------------
Which will only show these fields if your the admin username to make it easy, otherwise it will comment them out, i don't care if they can view source and see that there was other fields i just dont want them to be able to use them.
Just like the way you have the "view your own data" If it was possible to link it in with that it would be even better but I'm going to the easy way out on this one cause from reading other posts it doesnt look like its possible to do that but even with this way if it was possible to hard code in with permissions it would be great but anything will do
Thanks again

Sergey Kornilov admin 1/16/2007

You can create a custom view in ASPRunnerPro where some fields will be hidden.

Using User Group Permissions you can direct regular users to this Custom View while admin users will be able to access main table with all fields.

P
paulthelegend author 1/16/2007

I've only been using ASPRunner for 3-4 days now so I'm still a novice, can you give me a bit more info, Im guessing a custom view just means to redo a view like in the normal way but to take out the fields i don't want and save it to a different filename. And then after that how do i redirect the group to that view and the admin to the other view. Sorry if it's a simple question and I'm annoying you, even if you give me a link to a page describing this or tell me what to type into help to find how to do this that would be great.

Thanks

J
Jane 1/17/2007

Paul,
yes, you right. View is another presentation of the table.

To create custom view proceed to the Datasource tables tab, select your table and click on the Add table view button.

Then check off required fields on the Choose fields tab and set up permission settings for this view on the User group permissions dialog on the Security --> Advanced security settings tab.

P
paulthelegend author 1/17/2007

I didn't even see that button, this program just gets better and better, took 2 minutes and it's done.
I created the custom view, and went into the permissions turned off all the other tables etc and left only the custom view ticked add/edit/view
Now when they log in they get menu.asp which has there view listed, same with when admin logs in they just see one link saying the table name and they click it and its there. I'm sure i can make a javascript to forward them past this page.
Thanks for the help

J
Jane 1/17/2007

Paul,
to redirect to the list page after use After successful login event on the Events tab.

Use Redirect to another page action as a sample.