CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Listbox restrictions with retrieved values

Print topic Send  topic

Author Message
flipandboef


Posts: 107
Posted: 01/25/2008, 10:48 AM

I have a page to create members. This page has a listbox to set the security for a member, that corersponds with the security used as in CC.
Values: 1 - Visitor / 2 - Designer / 3 - Editor / 4 - Admin

Is it possible to set restrictions to the listbox? I like to accomplish that an Editor (or lower) can not set a member as Admin (4), but only visitor, designer or editor.
Logged in as admin however should be able to do this.

The listed values in this listbox come out of the database table: SecLevels, with the fields: SecID (autonumber / prim key) and SecValue (text)

Any ideas if this is possible and if so, simple to accomplish?

--------
CC 3.1 / MS-Access DB / ASP
View profile  Send private message
DonB
Posted: 01/25/2008, 11:05 AM

If you can express it as a SQL query, then it is possible. Change the Data
Source 'where' parameters of the listbox.

--
DonB

http://ccswiki.gotodon.net


"flipandboef" <flipandboef@forum.codecharge> wrote in message
news:6479a2ef0c070b@news.codecharge.com...
>I have a page to create members. This page has a listbox to set the
>security for
> a member, that corersponds with the security used as in CC.
> Values: 1 - Visitor / 2 - Designer / 3 - Editor / 4 - Admin
>
> Is it possible to set restrictions to the listbox? I like to accomplish
> that an
> Editor (or lower) can not set a member as Admin (4), but only visitor,
> designer
> or editor.
> Logged in as admin however should be able to do this.
>
> The listed values in this listbox come out of the database table:
> SecLevels,
> with the fields: SecID (autonumber / prim key) and SecValue (text)
>
> Any ideas if this is possible and if so, simple to accomplish?
>
> --------
> CC 3.1 / MS-Access DB / ASP
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

flipandboef


Posts: 107
Posted: 01/25/2008, 11:16 AM

Hi Don,
Thanks for your responds..
I'm afraid I'm not really an expert with the SQL query.
Do you have maybe n example for this situation?
Assuming if I just use the Where function in CC, I limit the listings to all people ;o)

Thanks!
View profile  Send private message
flipandboef


Posts: 107
Posted: 01/28/2008, 7:03 AM

Any one any idea's / help on this?
View profile  Send private message
wkempees
Posted: 01/28/2008, 4:19 PM

Global description:

Your current logged in user has a securitylevel.
CCGetGroupID()
Your Listbox retreives from SecLevels the SecID and SecValue
resulting in the Listboxes Datasource (press the [...])

SELECT SecID, SecValue FROM SecLevels

So far so good, now you have to alter the DataSource:
Add a WHERE condition, click on the WHERE part of the left pane and in the
right lower pane
add:
SecID LessEqual UserID, Integer, Session

That should result in a list providing only the requested levels.

Walter

"flipandboef" <flipandboef@forum.codecharge> schreef in bericht
news:6479deeaadb385@news.codecharge.com...
> Any one any idea's / help on this?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

flipandboef


Posts: 107
Posted: 01/29/2008, 7:05 AM

Thanks for this wonderful explenation Walter!
However.. It's close but no cigar...
I used your explenation as described, but it now only shows the Visitor (1) while being logged in as the admin (4)

When I log in as Editor (3) it works indeed perfectly, the admin (4) is hidden, while Editor and lower shows up (3 - 1).

I have set the setting "higher level inclusive of lower levels" and works fine as I hide the Delete button for all user except the Admin, and that's working fine... So the conclusion is that settings are correct for this..

Any suggestions on what might cause this?
Again Walter,
Thanks so much for your help. I'll try playing around a little and if I find the problem before you can answer, I'll let you know.
View profile  Send private message
wkempees
Posted: 01/29/2008, 7:42 AM

My Bad!

This
SecID LessEqual UserID, Integer, Session
Should Read
SecID LessEqual GroupID, Integer, Session

But you probably already found it, lol.
Walter
Your Admin user is probably the first user you added to the user table and
therefore has userid=1
and should only show Visitors from the dropdown, in the wrong example code
that is.
Enjoy!

Walter

"flipandboef" <flipandboef@forum.codecharge> schreef in bericht
news:6479f40cd26df0@news.codecharge.com...
> Thanks for this wonderful explenation Walter!
> However.. It's close but no cigar...
> I used your explenation as described, but it now only shows the Visitor
> (1)
> while being logged in as the admin (4)
>
> When I log in as Editor (3) it works indeed perfectly, the admin (4) is
> hidden.
>
> I have set the setting "higher level inclusive of lower levels" and works
> fine
> as I hide the Delete button for all user except the Admin, and that's
> working
> fine... So the conclusion is that settings are correct for this..
>
> Any suggestions on what might cause this?
> Again Walter,
> Thanks so much for your help. I'll try playing around a little and
> if I
> find the problem before you can answer, I'll let you know.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

flipandboef


Posts: 107
Posted: 01/29/2008, 7:59 AM

Walter, I knew I could count on you ;-)
Working like a charm!... I indeed added the Admin as first, having indeed userid 1....
This sleepy head however did not thought of it to change to UserId to the GroupId (Still to early here in the states! :-P)...

Regardless: Thanks a billion for your help Walter!



"keep in touch with the Dutch"
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.