PHP MYSQL - Permission-Tiered File Management System

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rubin Remus
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 7:39 am

PHP MYSQL - Permission-Tiered File Management System

Post by Rubin Remus »

Hello everyone...

I'm in desperate need of help.

I've been asked to create a system where a user can view files and comment on them...

The problem is there needs to be three levels of permission.

SUPERADMIN with permission to view, add, delete, edit, etc, absoulutely everything.

ADMIN with permission to view files, add/delete/edit folders, files and comments below THEIR area.

USER with permission to view and comment on files in their area.

The thing is, there will be one superadmin, a varying number of admin's, and all of these will have a varying number of users below them. Users should not be able to see ANY other users files, and Admin should only be able to see what is within their section, and not other admins.

Superadmin needs to have access to everything.

Any ideas on a script to adapt or if this exists in some capacity somewhere? Or simply where to start?

Thanks alot for any help in advance.

RR
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP MYSQL - Permission-Tiered File Management System

Post by jackpf »

I assume you have a database set up to record users and file information?

Have a userlevel (float) ranging from 0 to 1 in the users table, and in the file information table. Then, when viewing/editing/deleting or whatever, check if the user's userlevel is >= the userlevel stored for that file.

That's how I'd do it anyway.
Rubin Remus
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 7:39 am

Re: PHP MYSQL - Permission-Tiered File Management System

Post by Rubin Remus »

I was hoping you'd know a download that I could use. Not too good with SQL & PHP...

Any ideas for a complete noob to get the job done quickly?

Thanks,

RR
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP MYSQL - Permission-Tiered File Management System

Post by jackpf »

Umm...well what kind of database structure do you have atm?

I think this is rather bespoke, so I'm not sure if there are programs already out there. Feel free to look though.
Rubin Remus
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 7:39 am

Re: PHP MYSQL - Permission-Tiered File Management System

Post by Rubin Remus »

The database itself is unpopulated. I haven't built it because I'm still trying to work out what it would need...

Tell me if my idea would work or not though:

An infinitive number of userlevels, but defined as their usernames...? And the creator of those usernames can see the content... For example, if an admin created 3 "usernames/userlevels", he'd be able to see the content of those... but userlevel1 couldn't see userlevel2 (or even know it exists)...

Does that make sense, or is that just about the vaguest description imaginable?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP MYSQL - Permission-Tiered File Management System

Post by jackpf »

Hmm....I'm not really sure :P

Basically, what I think you should do:

Admin, with userlevel 1. Admins can make new userlevels, with any value below 1 (which is an infinite number of values).
Then, when someone creates or uploads a file or whatever, it's default permissions is their userlevel. Maybe you could give users the option to restrict to certain userlevels below their own...but that's up to you.
That way, the admin will always be able to do anything and everything, and users will only be allowed access to what they have been allowed.

So say, Admin creates usergroup "moderators" with userlevel 0.5, and "users" with userlevel 0.1.

If a "user" creates a file, it'll have a permission of 0.1, so mods, the user, and admins can see it, because their userlevel is greater. If a mod creates a file, it will have permission of 0.5, so users can't see it, but the admin & mod can.

I do think you should give the user the option to specify who they want to be able to see it though... (they can only specify users below their own though...so no one can block out a moderator or an admin...unless they are above that userlevel).

If you get me :D I've just typed this up really quick - I'm about to leave college. So sorry if it doesn't make any sense lol.
Rubin Remus
Forum Newbie
Posts: 7
Joined: Tue Jul 07, 2009 7:39 am

Re: PHP MYSQL - Permission-Tiered File Management System

Post by Rubin Remus »

I understand what you mean, but I have no idea how to make this happen!

Erm... a little help?!

I'm your new charity case, lucky you!
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP MYSQL - Permission-Tiered File Management System

Post by jackpf »

I think you just need to read up on MySQL and PHP tutorials.

I'm afraid I don't have the time, nor the will, to write it for you. I'm a full time student.

If you can't do it yourself, maybe you should hire someone.
Post Reply