コード例 #1
0
ファイル: modal.py プロジェクト: epowers/gunnery
 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
コード例 #2
0
 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()
コード例 #3
0
ファイル: image_bookmark.py プロジェクト: xuhang57/atmosphere
 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()
コード例 #4
0
 def get_queryset(self):
     request_user = self.request.user
     return Image.current_apps(request_user)
コード例 #5
0
 def get_queryset(self):
     request_user = self.request.user
     return Image.images_for_user(request_user)
コード例 #6
0
ファイル: views.py プロジェクト: jnaudon/datal
        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')
コード例 #7
0
ファイル: image_metric.py プロジェクト: zhxu73/atmosphere
 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)
コード例 #8
0
ファイル: image_metric.py プロジェクト: xuhang57/atmosphere
 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)
コード例 #9
0
ファイル: views.py プロジェクト: anukat2015/datal
        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')
コード例 #10
0
ファイル: image.py プロジェクト: julianpistorius/atmosphere
 def get_queryset(self):
     request_user = self.request.user
     return Image.images_for_user(request_user)
コード例 #11
0
 def get_queryset(self):
     request_user = self.request.user
     return Image.current_apps(request_user)