public bool VerifyAdminForLeaf(int admin_id, int site_id, string token) //use when modifying a leaf { if (VerifyAdmin(admin_id, token) == false) { return(false); } Site QuerySite = dbQueryS.QueryFeaturelessSiteById(site_id); if (QuerySite.admin_id == admin_id) { return(true); } else { return(false); } }
//Site edit methods public ActionResult <Site> EditSiteTitleMethod(SiteTitleUpdateDto updated_site, string admin_token) { Site found_site = dbQuery.QueryFeaturelessSiteById(updated_site.site_id); if (authenticator.VerifyAdminForLeaf(found_site.admin_id, found_site.site_id, admin_token)) { found_site.title = updated_site.title; List <string> format_errors = authenticator.ValidateIncomingSite(found_site); if (format_errors.Count != 0) { return(StatusCode(400, format_errors[0])); } return(dbQuery.EditSiteTitle(found_site)); } else { return(StatusCode(400, "Invalid credentials.")); } }