What never should happen happened!
Let me explain. I think I found a little bug in your code. I have
already changed the permissions.inc file, but it still did not work. I
had the feeling that the default settings defined in "permission.inc"
are overwritten by the "get_permission" function in "users.inc", when no
setttings are found in the database table. In my case the function
returned "0", which should not happen as your comment in the code says.
I made a quick but unclean bugfix, which works for me. Here it is:
function get_permission($domain,$label) {
global $__PERMISSIONS;
if ($this->is_anonymous) {
return $__PERMISSIONS[$domain][$label];
}
// fetch permissions in database if they have not already been
fetched
if (!isset($this->_PERMISSION_DATA)) {
$this->_PERMISSION_DATA = get_permissions_for_user($this->id);
}
if (!isset($__PERMISSIONS[$domain][$label])) {
echo "Unknown permission $domain, $label";
exit;
} elseif (isset($this->_PERMISSION_DATA[$domain][$label])) {
return $this->_PERMISSION_DATA[$domain][$label];
} else {
//return 0; // this should never happen
return $__PERMISSIONS[$domain][$label];
}
}
Am Fr, 2003-07-11 um 05.41 schrieb Byrne Reese:
> This maybe an issue with documentation more than anything. :-/
>
> If you look around you will find a permissions.inc file, or a
> permissions.txt (I forget), the INSTALL instructions reference it
> though. This file defines a user's default permissions. I may have
> inadvertantly checked in a version of the file that has the edit_self
> permission set to 0 by default. To rectify this problem, just change
> this to '1' and refresh your page. The permission algorithm works like
> this:
>
> Load all permissions defined in the uber-"permissions.inc" file. This
> file defines all allowable permissions and their default value. Then for
> the currently logged in user, load from the permissions table all
> permissons explicitly set for them, and override any defaults...
>
> On Thu, 2003-07-10 at 02:55, Martin Scherer wrote:
> > Hello,
> >
> > I am trying out your PHP Users tool, because I want to use it in a
> > little project of mine. Most things are already working, but there is
> > one problem with how to set permissions. I created a normal user with
> > your interface, but there are no entries for this user in the permission
> > table of my database. So this user cannot even change his own profile.
> > So my question is, do I have to add the entries myself or is there
> > another solution? I want that every user that is added to the database
> > can edit his profile and can have a look at the userlist.
> >
> > Thanks in advance,
> > Martin Scherer
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email sponsored by: Parasoft
> > Error proof Web apps, automate testing & more.
> > Download & eval WebKing and get a free book.
> > http://www.parasoft.com/bulletproofapps
> > _______________________________________________
> > Majordojo-phpusers mailing list
> > Majordojo-phpusers@...
> > https://lists.sourceforge.net/lists/listinfo/majordojo-phpusers
|