This topic is locked

Using Events to show only Unique Records

10/25/2006 11:50:51 PM
ASPRunnerPro General questions
lefty author

I need to get the list and view pages to only show unique records to which a user belongs without having to use the advanced group field / permissions and adding each user to the group manually everytime someone registers . I still want to have a default group ; but users with unique Id's belonging to certain groups only see those records belonging to that group . I have setup a field in the users table for the group . Does anyone know how this can be accomplished? If I setup the user Id field and main table id field ; I will get all records from different groups . I want to be able to grab only records from certain groups. I can accomplish this for the administrators of each group as they will have access to add,edit , delete etc. and I only need to add one administrator for each group but adding each user to a certain group would be tedious everytime someone registers.
Example would be say ; I have a group called Club 1 , another group called Club 2. When a user from say Club 2 logs in ; I only want him to see records from his Club 2 not Club 1.

J
Jane 10/26/2006

John,
I'm not sure that I understand you properly.

If you want to set up user group permissions each user should be in one of the user group and you should edit user group field for each user or set up one default user group for all registered users.
Also you can define user group of each user in the BeforeLogin event.

But in this case you need to edit event code every time new user registers.

Here is a sample:

Function BeforeLogin(username, password)

if username="John from Club2" then

SESSION("GroupID") = "club2"

end if
BeforeLogin = True

End Function

lefty author 10/26/2006

John,

I'm not sure that I understand you properly.

If you want to set up user group permissions each user should be in one of the user group and you should edit user group field for each user or set up one default user group for all registered users.
Also you can define user group of each user in the BeforeLogin event.

But in this case you need to edit event code every time new user registers.

Here is a sample:



Thanks , for the reply ; my problem is what if I have hundreds of users from one group and hundreds of users for another group . I also need for them to see only unique data to their own group. I'm trying to get around having to setup each user in the group permissions area. If I set up just default user then they will see both groups of data . I thought maybe in the events area I could write a script that Identifies them by username , password and also by "group". The script that you supplied ; seems that I would have to add that script to the before login each time I get a new user.