UseBB Community

The official board for UseBB help and discussion

UseBB Community » 1.0 Discussion » permissions

permissions

Page: 1

Author Post
Moderator
Registered: Oct 2005
Posts: 425
Location: canada
There was a post somewhere around here that led to a link that explained the UseBB permissions settings ( for 0.5 i think where then was no ACP) but I can't seem to find it.

I want to set up a type of permission base and wanted to reference that page so that I could try to incorporate it with the permissions UseBB already uses.

As to have something similar to 0011222223 but in another table/location, but I can't figure out how or what function UseBB is using to read the numbers.

Thanks.
Developer
Registered: Apr 2004
Posts: 2180
Location: Belgium
functions::auth() checks the permissions string, the string itself is retrieved from the forum queries.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Moderator
Registered: Oct 2005
Posts: 425
Location: canada
Hmm, ok. I kind of just used something a little different, probably not as efficient but it seems to be giving the correct results, but it's not giving me the correct output.

Wondering if you can help me out with this as I am completely stumped.

I have a database field called auth. It is 4 characters long. And I have something like 3333, for all administrator permissions.

So, what I do is grab that from the database, get the permission i need using $var{0}.

And then compare it with $functions->get_user_level().

$functions->get_user_level() outputs as 3.
$var{0} outputs as 3.

But when i do the comparison with an if statement. It won't work, and won't even display the results I want it too.


/* //Make sure the user has permission
if ( !$functions->get_user_level() >= $auth{0} ) {

//
// Kick to login
//
$functions->redir_to_login();

} else {

//Do something elese

}


Even if i take out the !, either way, it just displays:

Quote
You don't have the appropriate permissions to do this. If in doubt, contact the administrator.


Even though I don't have that message coded anywhere in, so I am starting to think that it is a UseBB thing creating the message?
Developer
Registered: Apr 2004
Posts: 2180
Location: Belgium
I guess what you need is
if ( $functions->get_user_level() >= $auth{0} ) {
and have this block containing the action, the else block then contains
$functions->redir_to_login();


If you want to reverse this, you'll need
if ( !( $functions->get_user_level() >= $auth{0} ) ) {


The code you use converts the return value of $functions->get_user_level() to a boolean and inverts it, probably giving false which is obviously not bigger than $auth{0} (which is probably 3).
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Moderator
Registered: Oct 2005
Posts: 425
Location: canada
Ah, silly me. I always miss the obvious. Thanks Dietrich, that worked perfectly.

Page: 1

UseBB Community » 1.0 Discussion » permissions

UseBB Community is powered by UseBB 1 Forum Software