Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Permissions Field Resets when editing permissions

edited November 2009 in Vanilla 2.0 - 2.8
I've created an application for Garden that defines 5 new permissions, when I try to edit a role to change these permissions, the whole "Permissions" field in gdn_users for the users in the respective role is blanked, thus resulting in a Fatal error when they try to login.
Is this a bug in Garden, or the way I defined the permissions. (in the about.php file of the application)?

Comments

  • Options
    edited November 2009
    It would turn out that the Permissions field in the GDN_User table is actually a cache, It is cleared when you edit permissions relating to that users' group. The problem I saw was because of a discrepancy with my version of PHP, which was treating "$Permissions[$PermissionName]..." [Line 44, class.usermodel.php] as a string and not converting it to an array when "$Permissions[$PermissionName][] = ..." is used. I fixed it by inserting "$Permissions[$PermissionName] = array();" Above Line 44 in class.usermodel.php
  • Options
    MarkMark Vanilla Staff
    Thanks for the fix!

    Have you filled out the contributor's agreement?

    http://vanillaforums.org/contributors

    After you've done that, I can implement your contribution :)
  • Options
    Yep, done that.
    Althought it's not much of a contrubution :)
  • Options
    It'll probably need some kind of evaluator to tell if it's already array, otherwise "= arra();" will keep clearing, thereby only really evaluating the last occurence.
  • Options
    MarkMark Vanilla Staff
    Yeah - I was thinking the same thing.
  • Options
    MarkMark Vanilla Staff
    I changed it to this:
    if(is_numeric($JunctionID) && $JunctionID > 0) {
    if (!is_array($Permissions[$PermissionName]))
    $Permissions[$PermissionName] = array();

    $Permissions[$PermissionName][] = $JunctionID;
    } else {
    $Permissions[] = $PermissionName;
    }
  • Options
    oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    edited May 2010
    I have a major issue in Vanilla 2 RC1:

    The Permission update does not work for none of the users! It just deletes the whole "Permissons"-content in GDN_User when I update a user's role!!

    This prevents Users from logging in (obviously), displaying a "You're not authorized" message.

    Strange thing is: the permissions on the webinterface is saved & displayed correctly!? (might this be a caching issue?)

    Any clues?
  • Options
    oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    Anyone? Any idea why the permission-field is not being set properly in the DB?
    Any idea how to debug this?
  • Options
    oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    [SOLVED]

    It turns out that it's not an issue with the "Permission" field.

    Instead, the value "Garden.SignIn.Allow" in the Permissions-Table GDN_Permission was set to FALSE (0) for the Members-Role.
Sign In or Register to comment.