void evented::sendEventUp_grouped(event* evt) { if (has_group(evt->reciever_id)) { take_event(evt->clone()); } for (std::list<evented *>::iterator it = children.begin(); it != children.end(); it++) { if ((*it)->has_group(evt->reciever_id)) { (*it)->sendEventUp_grouped(evt); } } }
void UNIFAQParameterLibrary::populate(rapidjson::Value &group_data, rapidjson::Value &interaction_data, rapidjson::Value &comp_data) { // Schema should have been used to validate the data already, so by this point we are can safely consume the data without checking ... for (rapidjson::Value::ValueIterator itr = group_data.Begin(); itr != group_data.End(); ++itr) { Group g; g.sgi = (*itr)["sgi"].GetInt(); g.mgi = (*itr)["mgi"].GetInt(); g.R_k = (*itr)["R_k"].GetDouble(); g.Q_k = (*itr)["Q_k"].GetDouble(); groups.push_back(g); } for (rapidjson::Value::ValueIterator itr = interaction_data.Begin(); itr != interaction_data.End(); ++itr) { InteractionParameters ip; ip.mgi1 = (*itr)["mgi1"].GetInt(); ip.mgi2 = (*itr)["mgi2"].GetInt(); ip.a_ij = (*itr)["a_ij"].GetDouble(); ip.a_ji = (*itr)["a_ji"].GetDouble(); ip.b_ij = (*itr)["b_ij"].GetDouble(); ip.b_ji = (*itr)["b_ji"].GetDouble(); ip.c_ij = (*itr)["c_ij"].GetDouble(); ip.c_ji = (*itr)["c_ji"].GetDouble(); interaction_parameters.push_back(ip); } for (rapidjson::Value::ValueIterator itr = comp_data.Begin(); itr != comp_data.End(); ++itr) { Component c; c.inchikey = (*itr)["inchikey"].GetString(); c.registry_number = (*itr)["registry_number"].GetString(); c.name = (*itr)["name"].GetString(); // userid is an optional user identifier if ((*itr).HasMember("userid")){ c.userid = (*itr)["userid"].GetString(); } rapidjson::Value &groups = (*itr)["groups"]; for (rapidjson::Value::ValueIterator itrg = groups.Begin(); itrg != groups.End(); ++itrg) { int count = (*itrg)["count"].GetInt(); int sgi = (*itrg)["sgi"].GetInt(); if (has_group(sgi)){ ComponentGroup cg(count, get_group(sgi)); c.groups.push_back(cg); } } components.push_back(c); } }
ACCESS3res *nfsproc3_access_3_svc(ACCESS3args * argp, struct svc_req * rqstp) { static ACCESS3res result; char *path; post_op_attr post; mode_t mode; int access = 0; PREP(path, argp->object); post = get_post_cached(rqstp); mode = post.post_op_attr_u.attributes.mode; /* owner permissions */ if (is_owner(st_cache.st_uid, rqstp)) { if (mode & S_IRUSR) access |= ACCESS3_READ; if (mode & S_IWUSR) access |= ACCESS3_MODIFY | ACCESS3_EXTEND; if (mode & S_IXUSR) { access |= ACCESS3_EXECUTE; if (opt_readable_executables) access |= ACCESS3_READ; } } else if (has_group(st_cache.st_gid, rqstp)) { /* group permissions */ if (mode & S_IRGRP) access |= ACCESS3_READ; if (mode & S_IWGRP) access |= ACCESS3_MODIFY | ACCESS3_EXTEND; if (mode & S_IXGRP) { access |= ACCESS3_EXECUTE; if (opt_readable_executables) access |= ACCESS3_READ; } } else { /* other permissions */ if (mode & S_IROTH) access |= ACCESS3_READ; if (mode & S_IWOTH) access |= ACCESS3_MODIFY | ACCESS3_EXTEND; if (mode & S_IXOTH) { access |= ACCESS3_EXECUTE; if (opt_readable_executables) access |= ACCESS3_READ; } } /* root is allowed everything */ if (get_uid(rqstp) == 0) access |= ACCESS3_READ | ACCESS3_MODIFY | ACCESS3_EXTEND; /* adjust if directory */ if (post.post_op_attr_u.attributes.type == NF3DIR) { if (access & (ACCESS3_READ | ACCESS3_EXECUTE)) access |= ACCESS3_LOOKUP; if (access & ACCESS3_MODIFY) access |= ACCESS3_DELETE; access &= ~ACCESS3_EXECUTE; } result.status = NFS3_OK; result.ACCESS3res_u.resok.access = access & argp->access; result.ACCESS3res_u.resok.obj_attributes = post; return &result; }