Jump to content

Sitemap generator and permissions requirement?


CodingJungle

Recommended Posts

Posted

this is a new one for me, 

SELECT * FROM `pro_babble_rooms` AS `babble_rooms`  LEFT JOIN `pro_core_permission_index` AS `core_permission_index` ON core_permission_index.app='babble' AND core_permission_index.perm_type='rooms' AND core_permission_index.perm_type_id=babble_rooms.rooms_id WHERE (( FIND_IN_SET(2,perm_) ) OR perm_='*' )
Unknown column 'perm_' in 'where clause'

this is cause by line 201 in /applications/core/extensions/core/sitemap/Content.php:

$select = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', $nodeClass::$databaseTable, array( '(' . \IPS\Db::i()->findInSet( "perm_{$nodeClass::$permissionMap['read']}", array( \IPS\Settings::i()->guest_group ) ) . ' OR ' . "perm_{$nodeClass::$permissionMap['read']}=? )", '*' ) )->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id={$nodeClass::$databaseTable}.{$nodeClass::$databasePrefix}{$nodeClass::$databaseColumnId}", $nodeClass::$permApp, $nodeClass::$permType ) ), $nodeClass );

i wasn't aware "read" was required to be in the permission map. this seems to have started happening when i upgraded to 4.2.3, so i am assuming it is a undocumented change? 

Posted

The line in question has been the same since Dec 29 2015 (I had to dig through git history to confirm). :)

Quote

Some keys are required if your models implement certain other functionality:

  • view (can see the node) is always required (defined as the value 'view')
  • read (can read content items) is always required
  • add (can add content items) is always required
  • reply (can reply to content items) is required if your content items can be commented on
  • review (can review content items) is required if your content items support reviews

Note that our documentation states 'read' is always required if you implement permissions in your nodes.

Posted
3 hours ago, bfarber said:

The line in question has been the same since Dec 29 2015 (I had to dig through git history to confirm). :)

then what has changed? why am i suddenly since august 29 (shortly after upgrading to 4.2.3) getting these error messages? 

Posted
40 minutes ago, bfarber said:

Hard for me to say right now, however 'read' perm is a required permission when you implement permissions per the documentation, so I would work on getting it implemented.

i have, was just more curious after like a year and a half now, it just started doing this.

  • 1 month later...
Posted

I've the same problem with Awards app.

In my case I've:

    /**
     * @var array
     */
    public static $permissionMap = array(
        'view'     => 'view',
        'add'      => 2,
        'receive'  => 3,
        'self'     => 4,
        'restrict' => 5,
        'manage'   => 6,
        'awarded'  => 7
    );

It's enough add read in this way?

    /**
     * @var array
     */
    public static $permissionMap = array(
        'view'     => 'view',
        'add'      => 2,
        'receive'  => 3,
        'self'     => 4,
        'restrict' => 5,
        'manage'   => 6,
        'awarded'  => 7,
        'read'     => 8
    );

 

Posted
24 minutes ago, InvisionHQ said:

I've the same problem with Awards app.

In my case I've:


    /**
     * @var array
     */
    public static $permissionMap = array(
        'view'     => 'view',
        'add'      => 2,
        'receive'  => 3,
        'self'     => 4,
        'restrict' => 5,
        'manage'   => 6,
        'awarded'  => 7
    );

It's enough add read in this way?


    /**
     * @var array
     */
    public static $permissionMap = array(
        'view'     => 'view',
        'add'      => 2,
        'receive'  => 3,
        'self'     => 4,
        'restrict' => 5,
        'manage'   => 6,
        'awarded'  => 7,
        'read'     => 8
    );

 

 

yes

Posted

Thanks, If permissions exceed 7, as in my case,

is it a good practice to add a column in core_permission_index?

Another thing, I do not know if it can be useful but looking at the code I saw that in pages (blocks, fields) the "read" permission is missing.

59e5f61432e61_Schermata2017-10-17alle14_17_40.png.d2de32d9e33e3f1a171202bb1d751663.png59e5f6150e651_Schermata2017-10-17alle14_16_56.png.b3d28a015e3b943827d362660094080c.png

Posted

Blocks, Fields and several other classes don't need the read permission because they don't contain a contentItemClass


I would suggest to take a look at following article where everything is explained.

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...