internal KiiACLEntry(KiiACL <T, U> parent, KiiSubject subject) { if (parent == null) { throw new ArgumentException("parent is null"); } if (subject == null) { throw new ArgumentException("subject can not be null"); } mParent = parent; mSubject = subject; }
private IList <KiiACLEntry <T, U> > ParseListResponse(JsonObject json) { List <KiiACLEntry <T, U> > entries = new List <KiiACLEntry <T, U> >(); string[] actionNames = ActionNames; foreach (string name in actionNames) { JsonArray whiteList = json.OptJsonArray(name); if (whiteList == null) { continue; } for (int i = 0; i < whiteList.Length(); ++i) { U action; try { action = ToAction(name); } catch (Exception) { // Just ignore and continue if failed to parse action. // Could be the action newly introduced. continue; } KiiACL <T, U> acl = CreateFromAction(mParent, action); JsonObject entry = whiteList.GetJsonObject(i); KiiACLEntry <T, U> kae = null; if (entry.Has("groupID")) { string gid = entry.GetString("groupID"); kae = acl.Subject(KiiGroup.GroupWithID(gid)); entries.Add(kae); } else if (entry.Has("userID")) { string uid = entry.GetString("userID"); KiiSubject sbj = GetSubjetFromUserID(uid); kae = acl.Subject(sbj); entries.Add(kae); } } } return(entries); }