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.ApiGetOwnGrrUserHandler( interface_traits=interface_traits)
def GetGrrUser(self, args, token=None): # Everybody can get their own user settings. interface_traits = api_user.ApiGrrUserInterfaceTraits().EnableAll() try: self.access_checker.CheckIfUserIsAdmin(token.username) except access_control.UnauthorizedAccess: interface_traits.manage_binaries_nav_item_enabled = False return api_user.ApiGetOwnGrrUserHandler(interface_traits=interface_traits)
def testRendersTraitsPassedInConstructor(self): result = self.handler.Handle( None, context=api_call_context.ApiCallContext(username=u"foo")) self.assertFalse(result.interface_traits.create_hunt_action_enabled) handler = user_plugin.ApiGetOwnGrrUserHandler( interface_traits=user_plugin.ApiGrrUserInterfaceTraits( create_hunt_action_enabled=True)) result = handler.Handle( None, context=api_call_context.ApiCallContext(username=u"foo")) self.assertTrue(result.interface_traits.create_hunt_action_enabled)
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.ApiGetOwnGrrUserHandler( 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)
def GetGrrUser(self, args, context=None): # Everybody can get their own user settings. interface_traits = api_user.ApiGrrUserInterfaceTraits().EnableAll() try: # Without access to restricted flows, one can not launch Python hacks and # binaries. Hence, we don't display the "Manage binaries" page. self.access_checker.CheckIfHasAccessToRestrictedFlows( context.username) except access_control.UnauthorizedAccess: interface_traits.manage_binaries_nav_item_enabled = False return api_user.ApiGetOwnGrrUserHandler( interface_traits=interface_traits)
def GetGrrUser(self, args, context=None): return api_user.ApiGetOwnGrrUserHandler( interface_traits=api_user.ApiGrrUserInterfaceTraits().EnableAll())
def setUp(self): super(ApiGetOwnGrrUserHandlerTest, self).setUp() data_store.REL_DB.WriteGRRUser("foo") self.handler = user_plugin.ApiGetOwnGrrUserHandler()
def setUp(self): super(ApiGetOwnGrrUserHandlerTest, self).setUp() self.handler = user_plugin.ApiGetOwnGrrUserHandler()
def GetGrrUser(self, args, context=None): interface_traits = api_user.ApiGrrUserInterfaceTraits().EnableAll() interface_traits.hunt_approval_required = False return api_user.ApiGetOwnGrrUserHandler( interface_traits=interface_traits)