Retrieve access list for the user specified in load. The list is built by eauth module or from master eauth configuration. Return None if current configuration doesn't provide any ACL for the user. Return an empty list if the user has no rights to execute anything on
(self, load, token=None)
| 595 | return True |
| 596 | |
| 597 | def get_auth_list(self, load, token=None): |
| 598 | """ |
| 599 | Retrieve access list for the user specified in load. |
| 600 | The list is built by eauth module or from master eauth configuration. |
| 601 | Return None if current configuration doesn't provide any ACL for the user. Return an empty |
| 602 | list if the user has no rights to execute anything on this master and returns non-empty list |
| 603 | if user is allowed to execute particular functions. |
| 604 | """ |
| 605 | # Get auth list from token |
| 606 | if token and self.opts["keep_acl_in_token"] and "auth_list" in token: |
| 607 | return token["auth_list"] |
| 608 | # Get acl from eauth module. |
| 609 | auth_list = self.__get_acl(load) |
| 610 | if auth_list is not None: |
| 611 | return auth_list |
| 612 | |
| 613 | eauth = token["eauth"] if token else load["eauth"] |
| 614 | if eauth not in self.opts["external_auth"]: |
| 615 | # No matching module is allowed in config |
| 616 | log.debug('The eauth system "%s" is not enabled', eauth) |
| 617 | log.warning("Authorization failure occurred.") |
| 618 | return None |
| 619 | |
| 620 | if token: |
| 621 | name = token["name"] |
| 622 | groups = token.get("groups") |
| 623 | else: |
| 624 | name = self.load_name(load) # The username we are attempting to auth with |
| 625 | groups = self.get_groups(load) # The groups this user belongs to |
| 626 | eauth_config = self.opts["external_auth"][eauth] |
| 627 | if not eauth_config: |
| 628 | log.debug('eauth "%s" configuration is empty', eauth) |
| 629 | |
| 630 | if not groups: |
| 631 | groups = [] |
| 632 | |
| 633 | # We now have an authenticated session and it is time to determine |
| 634 | # what the user has access to. |
| 635 | auth_list = self.ckminions.fill_auth_list(eauth_config, name, groups) |
| 636 | |
| 637 | auth_list = self.__process_acl(load, auth_list) |
| 638 | |
| 639 | log.trace("Compiled auth_list: %s", auth_list) |
| 640 | |
| 641 | return auth_list |
| 642 | |
| 643 | def check_authentication(self, load, auth_type, key=None, show_username=False): |
| 644 | """ |
no test coverage detected