diff --git a/client/src/components/LanguageSelector.jsx b/client/src/components/LanguageSelector.jsx index 86dd953d9..3e4d115b2 100644 --- a/client/src/components/LanguageSelector.jsx +++ b/client/src/components/LanguageSelector.jsx @@ -12,7 +12,7 @@ export default class LanguageSelector extends React.PureComponent { handleChooseLocale = locale => e => { stopEvent(e); if (locale !== I18n.locale) { - Cookies.set("lang", locale, {expires: 356, secure: document.location.protocol.endsWith("https")}); + Cookies.set("lang", locale, {expires: 356, secure: document.location.protocol.startsWith("https")}); I18n.locale = locale; moment.locale(locale); languageSwitched(); diff --git a/server/api/organisation.py b/server/api/organisation.py index 7e1be8666..5a0d08740 100644 --- a/server/api/organisation.py +++ b/server/api/organisation.py @@ -216,8 +216,7 @@ def valid_co(collaboration_json): co_unit_identifiers = [unit["id"] for unit in collaboration_json.get("units", [])] if not co_unit_identifiers: return False - if not all(api_key_unit_id in api_key_unit_identifiers for api_key_unit_id in co_unit_identifiers): - return False + return all(api_key_unit_id in api_key_unit_identifiers for api_key_unit_id in co_unit_identifiers) valid_collaborations = [co for co in json_organisation.get("collaborations", []) if valid_co(co)] json_organisation["collaborations"] = valid_collaborations diff --git a/server/test/api/test_organisation.py b/server/test/api/test_organisation.py index f23d1febe..6bdecd80e 100644 --- a/server/test/api/test_organisation.py +++ b/server/test/api/test_organisation.py @@ -473,12 +473,12 @@ def test_find_api(self): self.assertEqual(1, len(group["collaboration_memberships"])) self.assertTrue(isinstance(group["collaboration_memberships"][0], int)) - def test_find_api_no_unit_access(self): + def test_find_api_unit_access(self): res = self.get("/api/organisations/v1", headers={"Authorization": f"Bearer {unihard_secret_unit_support}"}, with_basic_auth=False) collaborations = res["collaborations"] - self.assertEqual(0, len(collaborations)) + self.assertEqual(1, len(collaborations)) def test_search_users(self): self.login("urn:harry")