|
-
Mar 19th, 2012, 08:18 AM
#1
Thread Starter
PowerPoster
Custom Membership Provider question
Hi Guys,
I had an existing MySQL 5 database therefore I have created a custom membership provider. I am creating an application for a school. So the users can either be pupils or teachers or Administrators like myself. Now the existing users table I inherited had a field called User_Group which has a "T" if the user is a teacher. A "P" for a pupil. Or an "A" for an administrator.
I don't really like this approach. The need has arisen for me to check the user that is logged in. If it is a "Pupil" I need to display certain info.
My question is, should I implement a custom role provider for this scenario or just extend my membership class and add a property called UserGroup?
-
Mar 19th, 2012, 11:35 AM
#2
Fanatic Member
Re: Custom Membership Provider question
Just add teacher and pupils as roles, why complicate things?
-
Mar 20th, 2012, 01:25 AM
#3
Thread Starter
PowerPoster
Re: Custom Membership Provider question
thanks davebat,
What concerns me is that I have a pupil table to store the pupils profile information like firstname, email address. Then I have a staff table to store teachers information. I have to do a check when a user signs up to see if the email address is from the pupil table or from the staff table and assign them to the relevant role. do you think there is a better way of achieving this?
-
Mar 20th, 2012, 02:08 AM
#4
Re: Custom Membership Provider question
This reminds me of the datatable structure 1o1 with employees and bosses.
So you should probably merge staff with students and create a column for role id.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Mar 20th, 2012, 08:31 AM
#5
Fanatic Member
Re: Custom Membership Provider question
Hi Nitesh
I assume the staff and teacher data is different hence why they are in seperate tables. Personally I would store the fields that are the same for both teachers and pupils in one table such as name, email with a key indicating if they are teacher or pupil.
I would use this for a lookup to decide whether to give teacher or pupil as the role, and then any pupil specific info i would store in a different table linked by an ID from the first table, i would do the same for teachers (assuming they have data unique to them)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|