Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Fixed: Bug in Files & Images section when attempting to view a single file's details

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1838 Views
  • Matt
    Avatar
    Core Development Team
    84 Posts

    Fixed: Bug in Files & Images section when attempting to view a single file's details Link to this post

    If you've uploaded some files, then gone back to the 'Files' tab and clicked on one of these files, you'll notice a big, not-so-shiny error message. The fix to that error is below.

    Note: This fix will be included in the next version of SilverStripe.

    In sapphire/security/Member.php:
    - Change line 327 from this:
    $groups = DataObject::get('Group',"CanCMS=1 OR CanCMSAdmin=1");
    To this:
    $groups = DataObject::get('Group',"", "", "INNER JOIN `Permission` ON `Permission`.GroupID = `Group`.ID AND `Permission`.Code IN ('ADMIN', 'CMS_ACCESS_AssetAdmin')");

    - Add the following on line 339 (In between the commented out code and the return statement:
    if($groupIDList) $filterClause = "`GroupID` IN (" . implode( ',', $groupIDList ) . ")";
    else $filterClause = "";

    - Replace the first argument to extendedSQL with $filterClause, so from this:
    ...extendedSQL( "`GroupID` IN (" . implode( ',', $groupIDList ) . ") AND ( `CanCMS`=1 OR `CanCMSAdmin`=1 )",...
    To this:
    ...extendedSQL($filterClause,...

    We really need some code highlighting/parsing structure for the forums...

  • Peter
    Avatar
    Community Member
    4 Posts

    Re: Fixed: Bug in Files & Images section when attempting to view a single file's details Link to this post

    Thanks Matt,

    Yes, that fixed it. And yes, got the not very attractive SQL message and your other fix fixed that too

    Just to clarify for anyone else adding the fix, the last code change refers to line 341 and the new version should look like:

          return new SQLMap( singleton('Member')->extendedSQL( $filterClause, "Surname, FirstName", "", "INNER JOIN `Group_Members` ON `MemberID`=`Member`.`ID` INNER JOIN `Group` ON `Group`.`ID`=`GroupID`") );   

    Really happy with the way things are going on this CMS, keep up the good work.

    Cheers,

    Peter

    1838 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.