{"id":2102,"date":"2016-12-12T18:20:10","date_gmt":"2016-12-12T09:20:10","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=2102"},"modified":"2016-12-12T18:20:34","modified_gmt":"2016-12-12T09:20:34","slug":"ncmb%e3%81%a7%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%aeacl%e3%82%92%e5%a4%89%e6%9b%b4","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=2102","title":{"rendered":"NCMB\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eACL\u3092\u5909\u66f4"},"content":{"rendered":"<p>NCMB\u306e\u30e6\u30fc\u30b6\u3067\u306a\u304f<strong>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eACL<\/strong>\u3092\u5909\u66f4\u3059\u308b\u624b\u9806<\/p>\n<p>\u52d5\u4f5c\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u629c\u7c8b\u3057\u3066\u308b\u306e\u3067\u52d5\u4f5c\u78ba\u8a8d\u7121\u3057\u3067\u3059<\/p>\n<pre class=\"lang:default decode:true \">NCMBUser user;\r\n\tstring acltest;\r\n\t\/\/ Use this for initialization\r\n\tvoid Start () {\r\n\t\tuser = NCMBUser.CurrentUser;\r\n\t\tstring userName = user.UserName;\r\n\r\n\t\t\/\/UserType\u30d5\u30a3\u30fc\u30eb\u30c9\u306bsuper\u306e\u5165\u3063\u3066\u3044\u308b\u30e6\u30fc\u30b6\u3092\u691c\u7d22\u3057\u3066List\u306b\u5165\u308c\u308b\r\n\t\tNCMBQuery&lt;NCMBUser&gt; query = NCMBUser.GetQuery ();\r\n\t\tquery.WhereEqualTo (\"userType\", \"super\");\r\n\t\tquery.FindAsync ((List&lt;NCMBUser&gt; userList , NCMBException e) =&gt; {\r\n\t\t\tif (e != null) {\r\n\t\t\t\tUnityEngine.Debug.Log (\"\u5931\u6557 : \" + e.Message);\r\n\t\t\t} else {\r\n\t\t\t\tforeach (NCMBUser users in userList) {\r\n\t\t\t\t\tpairUsers.Add(users.UserName.ToString());\/\/SU\u306e\u540d\u524d\u3092\u30ea\u30b9\u30c8\u306b\u5165\u308c\u308b\r\n\t\t\t\t}\/\/foreach\u3053\u3053\u307e\u3067\r\n\t\t\t\tacltest = userList[0].ObjectId.ToString();\r\n\t\t\t}\r\n\t\t});\r\n\t\tgetuserlist();\r\n\r\n\t}\r\n\r\n\r\n\tvoid getuserlist(){\r\n\t\tstring userName = user.UserName;\r\n\t\tNCMBQuery&lt;NCMBObject&gt; query2 = new NCMBQuery&lt;NCMBObject&gt; (\"testobj\");\r\n\t\tquery2.WhereEqualTo (\"player\", userName);\/\/Player\u304cusername\u306e\u7d50\u679c\u3092\u691c\u7d22\r\n\t\tquery2.FindAsync ((List&lt;NCMBObject&gt; objList ,NCMBException e) =&gt; {\r\n\t\t\tif (e != null) {\r\n\t\t\t\t\/\/\u691c\u7d22\u5931\u6557\u6642\u306e\u51e6\u7406\r\n\t\t\t\tDebug.Log(\"e\");\r\n\t\t\t\treturn;\r\n\t\t\t} else {\r\n\t\t\t\tif ( objList == null || objList.Count == 0 ){\r\n\t\t\t\t\tDebug.Log(\"e\");\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tDebug.Log(objList.Count);\r\n\t\t\t\tint po = 0;\r\n\r\n\t\t\t\tforeach (NCMBObject objdata in objList) {\/\/ne\r\n\t\t\t\t\tvar acl = objdata.ACL;\/\/ACL\u66f8\u304d\u63db\u3048\u6e96\u5099\r\n\t\t\t\t\t\/\/\u8aad\u307f\u8fbc\u307f\u6a29\u9650\u5168close\r\n\t\t\t\t\tacl.PublicReadAccess = false;\r\n\t\t\t\t\t\/\/\u66f8\u304d\u8fbc\u307f\u6a29\u9650\u3092\u5168close\r\n\t\t\t\t\tacl.PublicWriteAccess = false;\r\n\r\n\t\t\t\t\t\/\/userName\u304d\u3063\u304b\u3051\u3067\u8aad\u307f\u66f8\u304d\u30a2\u30af\u30bb\u30b9\u304a\u8ffd\u52a0\u3059\u308b\r\n\t\t\t\t\tacl.SetWriteAccess (user.ObjectId.ToString(), true);\r\n\t\t\t\t\tacl.SetReadAccess (user.ObjectId.ToString(), true);\r\n\r\n\t\t\t\t\t\/\/\u4ed6\u306e\u65b9\u3078\u306e\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u7528\r\n\t\t\t\t\tacl.SetReadAccess (acltest, true);\r\n\r\n\t\t\t\t\tobjdata.ACL = acl;\/\/\u4fdd\u5b58\u6e96\u5099\r\n\t\t\t\t\tobjdata.SaveAsync ((NCMBException z) =&gt; {      \r\n\t\t\t\t\t\tif (z != null) {\r\n\t\t\t\t\t\t\t\/\/\u30a8\u30e9\u30fc\u51e6\u7406\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\/\/\u6210\u529f\u6642\u306e\u51e6\u7406\r\n\t\t\t\t\t\t\tDebug.Log(acltest);\r\n\t\t\t\t\t\t\t\/\/objdata.ACL = acl;\r\n\t\t\t\t\t\t\tDebug.Log(\"good\");\/\/\u9001\u4fe1\u6210\u529f\u306e\u610f\u5473\r\n\r\n\t\t\t\t\t\t}                   \r\n\t\t\t\t\t});\r\n\t\t\t\t}\/\/for each\u3053\u3053\u307e\u3067\r\n\r\n\t\t\t}\r\n\t\t});\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NCMB\u306e\u30e6\u30fc\u30b6\u3067\u306a\u304f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eACL\u3092\u5909\u66f4\u3059\u308b\u624b\u9806 \u52d5\u4f5c\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u629c\u7c8b\u3057\u3066\u308b\u306e\u3067\u52d5\u4f5c\u78ba\u8a8d\u7121\u3057\u3067\u3059 NCMBUser user; string acltest; \/\/ Use this for initiali &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=2102\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">NCMB\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eACL\u3092\u5909\u66f4<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,33,2],"tags":[],"class_list":["post-2102","post","type-post","status-publish","format-standard","hentry","category-c","category-ncmb","category-unity"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2102"}],"version-history":[{"count":2,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2102\/revisions"}],"predecessor-version":[{"id":2104,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2102\/revisions\/2104"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}