Permalink
Browse files

Fixing Collection GetAccessible function.

  • Loading branch information...
1 parent b9cd9dc commit 508cc11ac4d19cf5d35ce0e89d6387e92849a26c @a-fung committed Oct 22, 2012
Showing with 2 additions and 0 deletions.
  1. +1 −0 source/aspnetserver/Collection.cs
  2. +1 −0 source/haxe/afung/mangaWeb3/server/Collection.hx
@@ -216,6 +216,7 @@ public static Collection[] GetAccessible(AjaxBase ajax)
if (user != null)
{
where += " OR `id` IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(user.Id.ToString()) + " AND `access`='1')";
+ where = "(" + where + ") AND `cid` NOT IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(user.Id.ToString()) + " AND `access`='0')";
}
Dictionary<string, object>[] resultSet = Database.Select("collection", where);
@@ -194,6 +194,7 @@ class Collection
if (user != null)
{
where += " OR `id` IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(Std.string(user.Id)) + " AND `access`='1')";
+ where = "(" + where + ") AND `cid` NOT IN (SELECT `cid` FROM `collectionuser` WHERE `uid`=" + Database.Quote(Std.string(user.Id)) + " AND `access`='0')";
}
var resultSet:Array<Hash<Dynamic>> = Database.Select("collection", where);

0 comments on commit 508cc11

Please sign in to comment.