コード例 #1
0
    //NOTE: Even though these might say "0" references, they're all used by the macro system!
    //For now, this is JUST read limit!!
    public string PermissionLimit(SearchRequestPlus request, string requesters, string idField, string type)
    {
        var typeInfo = typeService.GetTypeInfo <ContentPermission>();
        var checkCol = permissionService.ActionToColumn(permissionService.StringToAction(type));

        //Note: we're checking createUserId against ALL requester values they gave us! This is OK, because the
        //additional values are things like 0 or their groups, and groups can't create content
        return($@"({idField} in 
            (select {nameof(ContentPermission.contentId)} 
             from {typeInfo.selfDbInfo?.modelTable}
             where {nameof(ContentPermission.userId)} in {requesters}
               and `{checkCol}` = 1
            ))"); //NOTE: DO NOT CHECK CREATE USER! ALL PERMISSIONS ARE NOW IN THE TABLE! NOTHING IMPLIED!
    }