I am working in a jsp project an got stuck in a big problem.

My project consist of accounts table for super admin, reseller, admin and users for executives and manager mapped in the account


Super admin can see or add details of reseller, admin, executives and manager, and edit its own account

Reseller can see or add details of admin,executives and manager ,and edit its own account but unable to create reseller

Admin can see or add details of executives and manager ,and can see or edit its own account but unable to create admin

Executives can see only his details and edit it

So the highest priority is for super admin account which have access of everyone,then comes reseller account which have access to the admin account and lower account that he created,then admin account can access manager and executives users ,then manager user can access executives and then executive can see only his information

I have accounts and users table,Accounts can be super admin, reseller, and admin they all have an account_id and users are manager and executives which has a user_id

My problem is that how to do that ,how to map these id because reseller have account_id and can add account id ( admin) so to fetch details of reseller i have to also fetch details of lower admin account

In the same way for every type of account or user which login i have to apply a different sql query For ex if i have an extra table of call-details which have details on which user(user_id) receive call and which account(account_id) the user is mapped so i have to apply different sql query for different accounts and users login

like for super-admin select * from call-details

for reseller select * from call-details of reseller and call-details of account associated with it

for admin select * from call-details where call receive on that account.

and so on and i have more table and more pages then it is very difficult to apply this approach.

Is there any approach by which i can solve this problem with a less difficult way. I tried my best to explain my problem please ask again if you have any doubts understanding my problem.

Any help would be appreciated.

  • Question: Can a SuperAdmin user create another SuperAdmin user, or is there only one SuperAdmin account which is initially created by the developers? – Bart van Ingen Schenau Aug 15 '14 at 6:43
  • only one super admin account which is created by developers – singhakash Aug 15 '14 at 6:46
  • Question: What is the difference between an account and a user? If there are two users with a Manager account, does that mean there are two Manager account records? If yes, how do those accounts records differ? – Bart van Ingen Schenau Aug 15 '14 at 6:47
  • Example account is a company and user is employee with manager and executives ,manager user have executives as there lower employee.An account can or cannot have manager.If an admin account wants to create a user he have an option of creating manager or executive.If he creates 2 users as manager they differ by executives assigned to them – singhakash Aug 15 '14 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.