Ejemplo n.º 1
0
def site_attribute_default_value() -> Optional[SiteId]:
    site_id = omd_site()
    authorized_site_ids = global_user.authorized_sites(
        unfiltered_sites=configured_sites()).keys()
    if site_id in authorized_site_ids:
        return site_id
    return None
Ejemplo n.º 2
0
def get_event_console_site_choices() -> List[Tuple[SiteId, str]]:
    return site_choices({
        site_id: site
        for site_id, site in global_user.authorized_sites(
            unfiltered_sites=configured_sites()).items()
        if site_is_local(site_id) or site.get("replicate_ec", False)
    })
Ejemplo n.º 3
0
def site_attribute_default_value() -> Optional[SiteId]:
    def_site = default_site()
    authorized_site_ids = user.authorized_sites(
        unfiltered_sites=configured_sites()).keys()
    if def_site and def_site in authorized_site_ids:
        return def_site
    return None
Ejemplo n.º 4
0
def activation_sites() -> SiteConfigurations:
    """Returns sites that are affected by WATO changes

    These sites are shown on activation page and get change entries
    added during WATO changes."""
    return {
        site_id: site
        for site_id, site in user.authorized_sites(unfiltered_sites=configured_sites()).items()
        if site_is_local(site_id) or site.get("replication")
    }
Ejemplo n.º 5
0
 def _get_site_ids(self) -> List[SiteId]:
     """Create list of all site IDs the user is authorized for"""
     site_ids: List[SiteId] = []
     for site_id, _site in user.authorized_sites().items():
         site_ids.append(site_id)
     return site_ids
Ejemplo n.º 6
0
def get_configured_site_choices() -> List[Tuple[SiteId, str]]:
    return site_choices(
        global_user.authorized_sites(unfiltered_sites=configured_sites()))
Ejemplo n.º 7
0
def sorted_sites() -> List[Tuple[SiteId, str]]:
    return sorted(
        [(site_id, s["alias"])
         for site_id, s in global_user.authorized_sites().items()],
        key=lambda k: k[1].lower(),
    )
Ejemplo n.º 8
0
def site_attribute_choices() -> List[Tuple[SiteId, str]]:
    authorized_site_ids = user.authorized_sites(
        unfiltered_sites=configured_sites()).keys()
    return site_choices(
        filter_func=lambda site_id, site: site_id in authorized_site_ids)
Ejemplo n.º 9
0
def site_attribute_choices() -> List[Tuple[SiteId, str]]:
    return site_choices(
        user.authorized_sites(unfiltered_sites=configured_sites()))
Ejemplo n.º 10
0
def sorted_sites():
    # type: () -> List[Tuple[SiteId, str]]
    return sorted([(site_id, s['alias']) for site_id, s in user.authorized_sites().items()],
                  key=lambda k: k[1].lower())