Question

Locked

creating access level for each user

By programmer12 ·
hello,

im currently working on a project wherein each user's access to the application depends on the modules and submodules being selected on the provided form.

for instance:
- main_module 1
- submodule1
- module1
- module2
- submodule2

if admin selects, module1 and submodule2, then created user should only have access to those selected modules.

how should i structure my database?
hope someone could help me figure out this one..

thanks,

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Isn't the point of your project

by NexS In reply to creating access level for ...

To show how you can work these problems out by yourself?

Collapse -

Re:

by programmer12 In reply to Isn't the point of your p ...

yeah i know. i've already figured out the other parts of this project. i already have in mind some possible dbase structure for this part but i find it not so efficient. that's why im asking help from you now. if you could help me find the best solution for this. thanks:)

Collapse -

Dependencies?

by TobiF In reply to Re:

If you grant a user access to subunit2, would he need access to unit 2 and to main unit, as well, in order for everything to work?
In that case, you'll need a database of dependencies, that either is checked when a unit is about to run, or when changes are made to user permissions.
Oh, and if you've gone the second way (which may be economical, since the dependencies don't need to be checked every single time a unit is called), then you must handle differences between assigned and implied permissions, so that you can do correct housekeeping when a permission is deleted.
(Say if subunits 2a and 2b are granted, then unit 2 still needs to be around, even if subunit 2b is deleted...)

One more thing, probably better to create a relational database, rather than a hardcoded list of subunits, which might need to be altered any time you add a new unit to the system.

Collapse -

Re: Dependencies

by programmer12 In reply to Dependencies?

thanks for your reply. so far, i got 4 tables already:
1st - users
2nd - modules,
3rd - units(one column is intended for moduleID where it is under)
4th - subunits ( includes 1 column for unit where it is connected)

the fifth table should contain each user's access to the app.

, i already plotted some table drafts for this.
one of the drafts i have is:

userID | moduleID

, with this structure, when a user was given a full access to a module, he will automatically gain access to all the units and subunits of the module. however, the problem occurs when a user was given access to selected units and subunits. ( say he was given access to 2 out of 5 subunits). i always got stocked to this point.

how should i organize my table in such a way that this problem will be resolved? thanks a lot for help.

Collapse -

You need to do it in a more generic way

by TobiF In reply to Re: Dependencies

Your current design will break the moment you get a sub-sub-level...
And your design allows only for hierarchical dependencies. (I.e. you can't tie in a resource that would be shared by two subunits, for instance)

Better to list all units (regardless of "level") in one table.

Then have a separate table with the dependencies.

EditAdd: In the same way, you'd better have User Access to different units in a separate table.

Collapse -

Re: You need to do it in a more generic way

by programmer12 In reply to You need to do it in a mo ...

could you please further elaborate why i should prepare another table listing all units(regardless of their level) and create another table for their dependencies.. thanks.

Collapse -

I'm not sure

by TobiF In reply to Re: You need to do it in ...

Now I'm getting in to those parts that you need to "get".

But, in short, my suggestion is that you cut the information you currently have in tables 2-4 in a different way. (one table that lists modules/units/subunits etc.; another one that lists dependencies)
This allows for a more flexible design, where you can easily allow for an additional level of units, and where specific units can have dependencies to several different other units. (That would allow even for, say, a virtual module whose single purpose is to allow access to a particular set of other units in a convenient way.)

It's good that you've already split users and access levels into separate tables.

Back to Mobile Apps Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums