def permission_check(self, action): if action == 'create': if not self.request.user.has_perm('core.change_application', Application(id=self.parent_id)): raise ModalPermissionException elif not self.request.user.has_perm('core.change_environment', Environment(id=self.id)): raise ModalPermissionException
def get_queryset(self): """ Filter projects by current user """ user = self.request.user application_ids = list( Application.shared_with_user(user).values_list('id', flat=True)) return ImageBookmark.objects.filter(user=user).filter( Q(application__id__in=application_ids)).distinct()
def get_queryset(self): """ Filter projects by current user """ user = self.request.user now_time = timezone.now() application_ids = list(Application.shared_with_user(user).values_list('id', flat=True)) return ImageBookmark.objects.filter(user=user).filter( Q(application__id__in=application_ids)).distinct()
def get_queryset(self): request_user = self.request.user return Image.current_apps(request_user)
def get_queryset(self): request_user = self.request.user return Image.images_for_user(request_user)
try: example_guid = objs[0].guid except: example_guid = 'GUID' auth_manager = request.auth_manager return render(request, 'manageDeveloper/query_list.html', locals()) def create(request): try: account = request.account except AttributeError, e: account = None hash_lenght = 40 api_key = hashlib.sha224(str(random.random())).hexdigest()[0:hash_lenght] public_api_key = hashlib.sha224(str( random.random())).hexdigest()[0:hash_lenght] application = Application() application.auth_key = api_key application.public_auth_key = public_api_key application.valid = True application.expires_at = '2011-12-31 23:59:59Z' application.type = '00' application.account = account application.save() return HttpResponse('{"pApiKey":"%s", "pPublicApiKey":"%s"}' % (api_key, public_api_key), content_type='application/json')
def get_queryset(self): request_user = self.request.user if type(request_user) == AnonymousUser or not request_user.is_staff: return Application.objects.none() return Application.images_for_user(request_user)
msprotocol = 'https' if account.get_preference('account.microsite.https') else 'http' base_uri = msprotocol + '://' + preferences['account_domain'] objs = DataStream.objects.filter(user__account_id=request.account.id, datastreamrevision__status=3) try: example_guid = objs[0].guid except: example_guid = 'GUID' auth_manager = request.auth_manager return render_to_response('manageDeveloper/query_list.html', locals()) def create(request): try: account = request.account except AttributeError, e: account = None hash_lenght = 40 api_key = hashlib.sha224(str(random.random())).hexdigest()[0:hash_lenght] public_api_key = hashlib.sha224(str(random.random())).hexdigest()[0:hash_lenght] application = Application() application.auth_key = api_key application.public_auth_key = public_api_key application.valid = True application.expires_at = '2011-12-31 23:59:59' application.type = '00' application.account = account application.save() return HttpResponse('{"pApiKey":"%s", "pPublicApiKey":"%s"}' % (api_key, public_api_key), content_type='application/json')