Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Existing user database integration + segregation
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Existing user database integration + segregation

 Post Reply Post Reply Page  12>
Author
gariputro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 October 2006
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote gariputro Quote  Post ReplyReply Direct Link To This Post Topic: Existing user database integration + segregation
    Posted: 17 October 2006 at 4:22pm
I know it sounds confusing, so let me explain.  I have a site that contains an existing SQL user database.  I already know how, and have performed, the function of using my existing user database as the forum members database:
 
Now that I have the forum setup and users are able to access it without logging in, I need the ability to control what the users see based on their rights within the website (see example):
 
User A logs into the website, visits the forum, and is only allowed to see section A of the forum
User B logs into the website, visits the forum, and is only allowed to see section B of the forum
 
I have the forum set up with group permissions and I have User A separate from User B in the SQL database based on a field where I store an access rights number (eg A=1, B=2, Admin=9, etc), so how do I pass that information to the forum and automatically assign them to a group when they visit, thereby restricting what they can view within the forum?


Edited by gariputro - 17 October 2006 at 4:23pm
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2006 at 4:39pm
The simplest way would be for you to edit the file functions_member_API.asp

At line 222 you will find the following line:-

intForumStartingGroup = CInt(rsCommon("Group_ID"))

This line gets the Gorup_ID number of the strating group to place the user in.

What you would need to do is change this so based on your login system if it is user A they are given the group ID of the group you want them to be in and another for group B users:-

If UserA Then
    intForumStartingGroup = 3
ElseIf UserB Then
    intForumStartingGroup = 4
End If

You can get the Group_ID number by looking in ten tblGroup table in the database and get the ID numbers for the groups you want to use.
Back to Top
gariputro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 October 2006
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote gariputro Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2006 at 4:55pm
That is just the type of answer I was looking for!  I was hoping that someone would point me to a spot in the scripts where the group is assigned/checked.  I will give this a try.  Thanks boRg!
Back to Top
gariputro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 October 2006
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote gariputro Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 4:51pm
And now onto my question #2...
 
How can I update this the GroupID on the fly, so that when I change a user designation within my own login system, the next time that user logs in their GroupID is changed?
 
Your previous example works perfectly for users visiting the forum for the very first time.  Once I got that up and running, I copied and inserted the code to around line 172 in functions_members_API.asp and then inserted: 
 
rsCommon.Fields("Group_ID") = intForumStartingGroup
 
at line 182 (just before the rsCommon.Update) hoping that the user designation would be read from Session, converted to a GroupID number and rewritten to the database, just as a changed password would.  Doing this however, gives me an error message:
 
Server Error in Forum Application
An error has occured while writing to the database.
Please contact the forum administrator.

Support Error Code:- err_SQLServer_existingMemberAPI()_update_pass
File Name:- functions_member_API.asp

Error details:-
ADODB.Recordset
Item cannot be found in the collection corresponding to the requested name or ordinal.
 
Did I miss something?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 5:11pm
It looks like a simple change may not do it and the API file may need to be re-written to accommodate the customisations you require. If you are unsure about ASP programming you may need to ask a developer about this.
Back to Top
gariputro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 October 2006
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote gariputro Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 5:25pm
Well, I by no means am an ASP programmer.  PHP, that's another story.
 
In looking at the code, I realize it wouldn't be a quick fix, but wouldn't it still be rather easy?  I would need to modify the SQL statement to also pull 'strDbTable & "Permissions.Group_ID"' from the Permissions table (this is all on a shared server which I have limited access to, so if I get a tbl name wrong, don't burn me), then read it as an rsCommon and overwrite it.  Have I oversimplified it?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 5:30pm
Without going all through the code it looks like you might have found a solution yourself.

If you download the Access version and open the database you will get all the table names and field names so you shouldn't get them wrong.

All the table names and field names are the same no matter which database you are using.
Back to Top
gariputro View Drop Down
Newbie
Newbie
Avatar

Joined: 17 October 2006
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote gariputro Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 6:33pm
Found a solution, no.  Have a theory, yes!
 
I'll post back if I can figure out how to make this work.  I'm sure someone else can benefit from my sweat. Smile
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.