Exemplo n.º 1
0
  def testRendersTraitsPassedInConstructor(self):
    result = self.handler.Handle(None,
                                 token=access_control.ACLToken(username="******"))
    self.assertFalse(result.interface_traits.create_hunt_action_enabled)

    handler = user_plugin.ApiGetGrrUserHandler(
        interface_traits=user_plugin.ApiGrrUserInterfaceTraits(
            create_hunt_action_enabled=True))
    result = handler.Handle(None, token=access_control.ACLToken(username="******"))
    self.assertTrue(result.interface_traits.create_hunt_action_enabled)
Exemplo n.º 2
0
    def GetGrrUser(self, args, token=None):
        # Everybody can get their own user settings.

        interface_traits = api_user.ApiGrrUserInterfaceTraits().EnableAll()
        try:
            self.CheckIfUserIsAdmin(token=token)
        except access_control.UnauthorizedAccess:
            interface_traits.manage_binaries_nav_item_enabled = False

        return api_user.ApiGetGrrUserHandler(interface_traits=interface_traits)
Exemplo n.º 3
0
 def setUp(self):
   super(ApiGetGrrUserHandlerTest, self).setUp()
   self.handler = user_plugin.ApiGetGrrUserHandler()
Exemplo n.º 4
0
    def GetGrrUser(self, args, token=None):
        # Everybody can get their own user object.

        interface_traits = api_user.ApiGrrUserInterfaceTraits(
            search_clients_action_enabled=True)
        return api_user.ApiGetGrrUserHandler(interface_traits=interface_traits)
Exemplo n.º 5
0
 def GetGrrUser(self, args, token=None):
     return api_user.ApiGetGrrUserHandler(
         interface_traits=api_user.ApiGrrUserInterfaceTraits().EnableAll())