Exemplo n.º 1
0
 def accessDecisionManager(self):
     """This AccessDecisionManager decides based on what ROLE_xxx the current user has."""
     adm = AffirmativeBased()
     adm.allow_if_all_abstain = False
     adm.access_decision_voters = []
     adm.access_decision_voters.append(RoleVoter()) 
     return adm
Exemplo n.º 2
0
 def accessDecisionManager(self):
     """This AccessDecisionManager decides based on what ROLE_xxx the current user has."""
     adm = AffirmativeBased()
     adm.allow_if_all_abstain = False
     adm.access_decision_voters = []
     adm.access_decision_voters.append(RoleVoter()) 
     return adm
Exemplo n.º 3
0
 def accessDecisionManager(self):
     adm = AffirmativeBased()
     adm.allow_if_all_abstain_decisions = False
     adm.access_decision_voters = []
     adm.access_decision_voters.append(self.vetRoleVoter())
     adm.access_decision_voters.append(self.customerRoleVoter())
     adm.access_decision_voters.append(self.ownerVoter())
     return adm
Exemplo n.º 4
0
 def accessDecisionManager(self):
     adm = AffirmativeBased()
     adm.allow_if_all_abstain_decisions = False
     adm.access_decision_voters = []
     adm.access_decision_voters.append(self.vetRoleVoter())
     adm.access_decision_voters.append(self.customerRoleVoter())
     adm.access_decision_voters.append(self.ownerVoter())
     return adm
Exemplo n.º 5
0
    def testProgrammaticSetupForAffirmativeBased(self):
        inMemoryUserDetailsService = InMemoryUserDetailsService()
        inMemoryUserDetailsService.user_dict["blueuser"] = ("password1",
                                                            ["LABEL_BLUE"
                                                             ], False)
        inMemoryUserDetailsService.user_dict["superuser"] = ("password2",
                                                             ["LABEL_SHARED"
                                                              ], False),
        inMemoryUserDetailsService.user_dict["orangeuser"] = ("password3",
                                                              ["LABEL_ORANGE"
                                                               ], False),
        inMemoryUserDetailsService.user_dict["multiuser"] = ("password4", [
            "LABEL_BLUE", "LABEL_ORANGE"
        ], False)
        inMemoryDaoAuthenticationProvider = DaoAuthenticationProvider()
        inMemoryDaoAuthenticationProvider.userDetailsService = inMemoryUserDetailsService
        authenticationProvider = AuthenticationManager(
            [inMemoryDaoAuthenticationProvider])

        auth_manager = AuthenticationManager()
        auth_manager.authenticationProviderList = [authenticationProvider]

        labelBasedAclVoter = LabelBasedAclVoter()
        labelBasedAclVoter.label_dict["LABEL_BLUE"] = ["blue", "blue-orange"]
        labelBasedAclVoter.label_dict["LABEL_ORANGE"] = [
            "orange", "blue-orange"
        ]
        labelBasedAclVoter.label_dict["LABEL_SHARED"] = [
            "blue", "orange", "blue-orange"
        ]
        labelBasedAclVoter.attr_indicating_labeled_op = "LABELED_OPERATION"
        labelBasedAclVoter.access_decision_mgr = AffirmativeBased(access_decision_voters = [labelBasedAclVoter], \
                                                                    allow_if_all_abstain = False)