File manager - creating user rights admin class

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
merlin89
Forum Newbie
Posts: 17
Joined: Thu Nov 10, 2005 7:57 am

File manager - creating user rights admin class

Post by merlin89 »

In a prior postin I had an issue with how to set up user rights for access to files and folders ..thinking about it I would like to implement a file manager admin class that deals with this. It will have to interface with the current login system I am using which is fine so rather than redesign the wheel for that the creation of a seperate admin class will just mean the redesign the admin page for the login script. But initially I cna design the admin class as a sepearate entity. The requirements fo my admin class are as follows:

1.Add a user to the file manager
2.Delete a user from the file manager
3.Delete a right for a user from the file manager
4.Edit a user of the file manager
5.Return the list of user accounts on this file manager
6.Get a user's parameters and rights
7.Return the list of rights associated with a username
8.Add rights to a folder for a user
9.Check a user login/pass and return his right
10. User rights are to inlcude Read file ,upload file,delete file, copy file, move file, rename file, create folder, rename folder, delete folder.

Having never written a class I though Id start off with a picemeal approach see if it'll work first of all so initially I want a class admin that:
1.Add a user to the file manager
2.Delete a user from the file manager
3.Add rights to a folder for a user
4.User rights are to inlcude Read file ,upload file,delete file

all information about the rights are held within a mysql db
now for the variables and functions....... or should I draw a small UML diag 1st

Any ideas are welcome
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Each function will be it's own method (bit of a no brainer that one..)

If you have any common tasks, then create extra functions for them.

Code: Select all

<?php

class UserAdmin
{
    /* anything that will be used outside of method scope should be declared here first */
    function addUser ()
    {
        /* add user functionality */
    }

    function delUser ()
    {
        /* delete user functionality */
    }

    function changePermission ()
    {
        /* change permission functionality */
    }
}
?>
I personally do not like UML, though I understand and appreciate how it can be very powerful, I just don't like it :)

However, I think I am in the minority on that. :)
Post Reply