/// <summary> /// Returns all of the roles in a planet /// </summary> public async Task <TaskResult <List <ServerPlanetRole> > > GetPlanetRoles(ulong planet_id, string token) { AuthToken authToken = await Context.AuthTokens.FindAsync(token); if (authToken == null) { return(new TaskResult <List <ServerPlanetRole> >(false, "Failed to authorize user.", null)); } ServerPlanet planet = await Context.Planets.FindAsync(planet_id); if (planet == null) { return(new TaskResult <List <ServerPlanetRole> >(false, $"Could not find planet {planet_id}", null)); } if (!(await planet.IsMemberAsync(authToken.User_Id, Context))) { return(new TaskResult <List <ServerPlanetRole> >(false, "Failed to authorize user.", null)); } var roles = await planet.GetRolesAsync(Context); return(new TaskResult <List <ServerPlanetRole> >(true, $"Found {roles.Count} roles.", roles)); }