Developer forum

Forum » Development » Item repository and permissions

Item repository and permissions

Morten Bengtson
Reply

We are using the item repository API to fetch some paragraph based items...

var itemids = new[] { "1" };

using (var repository = ItemManager.Storage.Open("Article"))
{
    var item = repository.SelectByIds(itemids, null, true).FirstOrDefault();
}

But there seems to be some bugs in the API. Here is some decompiled source code from Dynamicweb.Content.Items.Queries.Repository...

public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions)
{
    // Problem 1: Why is the "checkPermissions" parameter ignored here? Shouldn't it be passed on instead?
    return this.SelectByIds(ids, query, false, false);
}

public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions, bool includeInheritedItems)
{
    // Problem 2: The sql that is generated when checking for permissions is broken. 
    // One of the conditions checks that ParagraphItemType is in the list of item ids (list2 in the decompiled source code)
    ...
    commandBuilder2.Add("AND ( [Paragraph].[ParagraphItemType] in ({0}) )", new object[1]
    {
        (object) list2
    });
    ...
}

DW version: 8.6.1.6

Is there a better way to fetch paragraph items AND check for permissions?


Replies

 
Vladimir
Reply
This post has been marked as an answer

Hi Morten,

I'm sorry for the inconvenience caused

1) I will fix it asap for the next hotfix

2) Was fixed already in latest 8.6.1 v

Best regards,

Vladimir

Votes for this answer: 1
 
Morten Bengtson
Reply

OK. Thanks :)

 

You must be logged in to post in the forum