• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.ObjectACL类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tardis.tardis_portal.models.ObjectACL的典型用法代码示例。如果您正苦于以下问题:Python ObjectACL类的具体用法?Python ObjectACL怎么用?Python ObjectACL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ObjectACL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

 def setUp(self):
     super(MyTardisResourceTestCase, self).setUp()
     self.username = 'mytardis'
     self.password = 'mytardis'
     self.user = User.objects.create_user(username=self.username,
                                          password=self.password)
     test_auth_service = AuthService()
     test_auth_service._set_user_from_dict(
         self.user,
         user_dict={'first_name': 'Testing',
                    'last_name': 'MyTardis API',
                    'email': '[email protected]'},
         auth_method="None")
     self.user.user_permissions.add(
         Permission.objects.get(codename='change_dataset'))
     self.user.user_permissions.add(
         Permission.objects.get(codename='add_dataset_file'))
     self.user_profile = UserProfile(user=self.user).save()
     self.testexp = Experiment(title="test exp")
     self.testexp.approved = True
     self.testexp.created_by = self.user
     self.testexp.locked = False
     self.testexp.save()
     testacl = ObjectACL(
         content_type=self.testexp.get_ct(),
         object_id=self.testexp.id,
         pluginId=django_user,
         entityId=str(self.user.id),
         canRead=True,
         canWrite=True,
         canDelete=True,
         isOwner=True,
         aclOwnershipType=ObjectACL.OWNER_OWNED)
     testacl.save()
开发者ID:TheGoodRob,项目名称:mytardis,代码行数:34,代码来源:test_api.py


示例2: _create_test_data

def _create_test_data():
    user = User(username='tom',
                first_name='Thomas',
                last_name='Atkins',
                email='[email protected]')
    user.save()
    license_ = License(name='Creative Commons Attribution-NoDerivs 2.5 Australia',
                       url='http://creativecommons.org/licenses/by-nd/2.5/au/',
                       internal_description='CC BY 2.5 AU',
                       allows_distribution=True)
    license_.save()
    experiment = Experiment(title='Norwegian Blue',
                            description='Parrot + 40kV',
                            created_by=user)
    experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
    experiment.license = license_
    experiment.save()
    experiment.experimentauthor_set.create(order=0,
                                           author="John Cleese",
                                           url="http://nla.gov.au/nla.party-1")
    experiment.experimentauthor_set.create(order=1,
                                           author="Michael Palin",
                                           url="http://nla.gov.au/nla.party-2")
    acl = ObjectACL(content_object=experiment,
                    pluginId='django_user',
                    entityId=str(user.id),
                    isOwner=True,
                    canRead=True,
                    canWrite=True,
                    canDelete=True,
                    aclOwnershipType=ObjectACL.OWNER_OWNED)
    acl.save()
    return user, experiment
开发者ID:mytardis,项目名称:mytardis,代码行数:33,代码来源:test_oai.py


示例3: setUp

 def setUp(self):
     self.client = Client()
     # old_user
     user_old_username = 'tardis_user1'
     # new_user
     user_new_username = 'tardis_user2'
     pwd = 'secret'
     email = '[email protected]'
     self.user_new = User.objects.create_user(user_new_username, email, pwd)
     self.user_old = User.objects.create_user(user_old_username, email, pwd)
     # create group
     self.group = Group.objects.create(name='test group')
     # add old user to group
     self.group.user_set.add(self.user_old)
     # add user auth
     user_auth = UserAuthentication(userProfile=UserProfile.objects.get(user=self.user_old),
                        username= self.user_old.username,
                        authenticationMethod='localdb')
     user_auth.save()
     # add experiments
     experiment = Experiment(title='Text Experiment',
                             institution_name='Test Uni',
                             created_by=self.user_old)
     experiment.save()
     acl = ObjectACL(
         pluginId='django_user',
         entityId=str(self.user_old.id),
         content_object=experiment,
         canRead=True,
         isOwner=True,
         aclOwnershipType=ObjectACL.OWNER_OWNED,
     )
     acl.save()
开发者ID:mytardis,项目名称:mytardis,代码行数:33,代码来源:test_migration.py


示例4: _get_experiment

 def _get_experiment(self, entry, user):
     experimentId, title, public_access = \
         self._get_experiment_details(entry, user)
     try:
         try:
             param_name = ParameterName.objects.\
                 get(name=self.PARAM_EXPERIMENT_ID, \
                     schema=AtomImportSchemas.get_schema(Schema.EXPERIMENT))
             parameter = ExperimentParameter.objects.\
                 get(name=param_name, string_value=experimentId)
         except ExperimentParameter.DoesNotExist:
             raise Experiment.DoesNotExist
         return parameter.parameterset.experiment
     except Experiment.DoesNotExist:
         experiment = Experiment(title=title,
                                 created_by=user,
                                 public_access=public_access)
         experiment.save()
         self._create_experiment_id_parameter_set(experiment, experimentId)
         acl = ObjectACL(content_object=experiment,
                 pluginId=django_user,
                 entityId=user.id,
                 canRead=True,
                 canWrite=True,
                 canDelete=True,
                 isOwner=True,
                 aclOwnershipType=ObjectACL.OWNER_OWNED)
         acl.save()
         return experiment
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-atom,代码行数:29,代码来源:atom_ingest.py


示例5: setUp

    def setUp(self):
        # Create test owner without enough details
        username, email, password = ("testuser", "[email protected]", "password")
        user = User.objects.create_user(username, email, password)
        # Need UserAuthentication
        UserAuthentication(userProfile=user.userprofile, username=username, authenticationMethod="localdb").save()
        # Create staging dir
        from os import path, makedirs

        staging_dir = path.join(settings.STAGING_PATH, username)
        if not path.exists(staging_dir):
            makedirs(staging_dir)
        # Ensure that staging dir is set up properly
        expect(get_full_staging_path(username)).to_be_truthy()

        # Create test experiment and make user the owner of it
        experiment = Experiment(title="Text Experiment", institution_name="Test Uni", created_by=user)
        experiment.save()
        acl = ObjectACL(
            pluginId=django_user,
            entityId=str(user.id),
            content_object=experiment,
            canRead=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED,
        )
        acl.save()

        self.dataset = Dataset(description="dataset description...")
        self.dataset.save()
        self.dataset.experiments.add(experiment)
        self.dataset.save()

        self.username, self.password = (username, password)
开发者ID:grischa,项目名称:mytardis,代码行数:34,代码来源:test_views.py


示例6: _create_test_experiment

def _create_test_experiment(user, license_):
    experiment = Experiment(title='Norwegian Blue',
                            description='Parrot + 40kV',
                            created_by=user)
    experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
    experiment.license = license_
    experiment.save()
    experiment.experimentauthor_set.create(
        order=0,
        author="John Cleese",
        url="http://nla.gov.au/nla.party-1")
    experiment.experimentauthor_set.create(
        order=1,
        author="Michael Palin",
        url="http://nla.gov.au/nla.party-2")
    acl = ObjectACL(content_object=experiment,
                    pluginId='django_user',
                    entityId=str(user.id),
                    isOwner=True,
                    canRead=True,
                    canWrite=True,
                    canDelete=True,
                    aclOwnershipType=ObjectACL.OWNER_OWNED)
    acl.save()
    return experiment
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:25,代码来源:test_rmexperiment.py


示例7: testRightsRequireValidOwner

    def testRightsRequireValidOwner(self):
        # Create test owner without enough details
        username, email, password = ("testuser", "[email protected]", "password")
        user = User.objects.create_user(username, email, password)

        # Create test experiment and make user the owner of it
        experiment = Experiment(title="Text Experiment", institution_name="Test Uni", created_by=user)
        experiment.save()
        acl = ObjectACL(
            pluginId=django_user,
            entityId=str(user.id),
            content_object=experiment,
            canRead=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED,
        )
        acl.save()

        # Create client and login as user
        client = Client()
        login = client.login(username=username, password=password)
        self.assertTrue(login)

        # Get "Choose Rights" page, and check that we're forbidden
        rights_url = reverse("tardis.tardis_portal.views.choose_rights", args=[str(experiment.id)])
        response = client.get(rights_url)
        expect(response.status_code).to_equal(403)

        # Fill in remaining details
        user.first_name = "Voltaire"  # Mononymous persons are just fine
        user.save()

        # Get "Choose Rights" page, and check that we're now allowed access
        response = client.get(rights_url)
        expect(response.status_code).to_equal(200)
开发者ID:grischa,项目名称:mytardis,代码行数:35,代码来源:test_views.py


示例8: setUp

    def setUp(self):
        # Create test owner without enough details
        username, email, password = ('testuser',
                                     '[email protected]',
                                     'password')
        user = User.objects.create_user(username, email, password)
        profile = UserProfile(user=user, isDjangoAccount=True)
        profile.save()

        Location.force_initialize()

        # Create test experiment and make user the owner of it
        experiment = Experiment(title='Text Experiment',
                                institution_name='Test Uni',
                                created_by=user)
        experiment.save()
        acl = ObjectACL(
            pluginId='django_user',
            entityId=str(user.id),
            content_object=experiment,
            canRead=True,
            canWrite=True,
            canDelete=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED)
        acl.save()

        dataset = Dataset(description='dataset description...')
        dataset.save()
        dataset.experiments.add(experiment)
        dataset.save()

        def create_datafile(filename):
            testfile = path.join(path.dirname(__file__), 'fixtures',
                                 filename)

            size, sha512sum = get_size_and_sha512sum(testfile)

            datafile = Dataset_File(dataset=dataset,
                                    filename=path.basename(testfile),
                                    size=size,
                                    sha512sum=sha512sum)
            datafile.save()
            base_url = 'file://' + path.abspath(path.dirname(testfile))
            location = Location.load_location({
                'name': 'test-grabber', 'url': base_url, 'type': 'external',
                'priority': 10, 'transfer_provider': 'local'})
            replica = Replica(datafile=datafile,
                              url='file://'+path.abspath(testfile),
                              protocol='file',
                              location=location)
            replica.verify()
            replica.save()
            return Dataset_File.objects.get(pk=datafile.pk)

        self.dataset = dataset
        self.datafiles = [create_datafile('data_grabber_test1.admin'),
                          create_datafile('testfile.txt')
                         ] 
开发者ID:UQ-CMM-Mirage,项目名称:mytardis-app-datagrabber,代码行数:59,代码来源:test_datagrabber.py


示例9: setUp

    def setUp(self):
        from os import path, mkdir
        from tempfile import mkdtemp

        user = 'tardis_user1'
        pwd = 'secret'
        email = ''
        self.user = User.objects.create_user(user, email, pwd)

        self.userProfile = UserProfile(user=self.user).save()

        self.test_dir = mkdtemp()

        Location.force_initialize()

        self.exp = Experiment(title='test exp1',
                institution_name='monash', created_by=self.user)
        self.exp.save()

        acl = ObjectACL(
            pluginId=django_user,
            entityId=str(self.user.id),
            content_object=self.exp,
            canRead=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED,
        )
        acl.save()

        self.dataset = \
            Dataset(description='dataset description...')
        self.dataset.save()
        self.dataset.experiments.add(self.exp)
        self.dataset.save()

        self.experiment_path = path.join(settings.FILE_STORE_PATH,
                str(self.dataset.get_first_experiment().id))

        self.dataset_path = path.join(self.experiment_path,
                                      str(self.dataset.id))

        if not path.exists(self.experiment_path):
            mkdir(self.experiment_path)
        if not path.exists(self.dataset_path):
            mkdir(self.dataset_path)

        # write test file

        self.filename = 'testfile.txt'

        self.f1 = open(path.join(self.test_dir, self.filename), 'w')
        self.f1.write('Test file 1')
        self.f1.close()

        self.f1_size = path.getsize(path.join(self.test_dir,
                                    self.filename))

        self.f1 = open(path.join(self.test_dir, self.filename), 'r')
开发者ID:crawley,项目名称:mytardis,代码行数:58,代码来源:test_views.py


示例10: add_epn_group_acl

def add_epn_group_acl(sender, **kwargs):
    try:
        par_name = ParameterName.objects.get(
            name='EPN', schema=Schema.objects.get(
                namespace='http://www.tardis.edu.au/schemas/as/'
                          'experiment/2010/09/21'))
    except (ParameterName.DoesNotExist, Schema.DoesNotExist):
        return
    exp_par = kwargs['instance']
    if exp_par.name != par_name:
        return
    exp = exp_par.parameterset.experiment
    try:
        epn = exp_par.string_value
        # create vbl group
        acl = ObjectACL.objects.filter(
            content_type=exp.get_ct(),
            object_id=exp.id,
            pluginId='vbl_group',
            entityId=epn,
            canRead=True,
            aclOwnershipType=ObjectACL.SYSTEM_OWNED)
        if len(acl) == 0:
            acl = ObjectACL(
                content_type=exp.get_ct(),
                object_id=exp.id,
                pluginId='vbl_group',
                entityId=epn,
                canRead=True,
                aclOwnershipType=ObjectACL.SYSTEM_OWNED)
            acl.save()
    except Exception:
        logger.exception('trouble creating EPN ACL')

    try:
        beamline_group = "BEAMLINE_MX"
        group, created = Group.objects.get_or_create(name=beamline_group)
        # beamline group
        ObjectACL.objects.get_or_create(
            content_type=exp.get_ct(),
            object_id=exp.id,
            pluginId=django_group,
            entityId=str(group.id),
            canRead=True,
            aclOwnershipType=ObjectACL.SYSTEM_OWNED)

        # finally, always add acl for admin group
        group, created = Group.objects.get_or_create(name='admin')
        ObjectACL.objects.get_or_create(
            content_type=exp.get_ct(),
            object_id=exp.id,
            pluginId=django_group,
            entityId=str(group.id),
            isOwner=True,
            canRead=True,
            aclOwnershipType=ObjectACL.SYSTEM_OWNED)
    except Exception:
        logger.exception('trouble creating beamline and admin ACLs')
开发者ID:mytardis,项目名称:aus_synch_app,代码行数:58,代码来源:hooks.py


示例11: setUp

    def setUp(self):
        # Create test owner without enough details
        username, email, password = ('testuser',
                                     '[email protected]',
                                     'password')
        user = User.objects.create_user(username, email, password)

        # Create test experiment and make user the owner of it
        experiment = Experiment(title='Text Experiment',
                                institution_name='Test Uni',
                                created_by=user)
        experiment.save()
        acl = ObjectACL(
            pluginId='django_user',
            entityId=str(user.id),
            content_object=experiment,
            canRead=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED,
        )
        acl.save()

        dataset = Dataset(description='dataset description...')
        dataset.save()
        dataset.experiments.add(experiment)
        dataset.save()

        base_path = path.join(path.dirname(__file__), 'fixtures')
        s_box = StorageBox.get_default_storage(location=base_path)

        def create_datafile(index):
            testfile = path.join(base_path, 'middleware_test%d.txt' % index)

            size, sha512sum = get_size_and_sha512sum(testfile)

            datafile = DataFile(dataset=dataset,
                                filename=path.basename(testfile),
                                size=size,
                                sha512sum=sha512sum)
            datafile.save()
            dfo = DataFileObject(
                datafile=datafile,
                storage_box=s_box,
                uri=path.basename(testfile))
            dfo.save()

            if index != 1:
                dfo.verified = False
                dfo.save(update_fields=['verified'])
            return DataFile.objects.get(pk=datafile.pk)

        self.dataset = dataset
        self.datafiles = [create_datafile(i) for i in (1, 2)]
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:53,代码来源:test_middleware.py


示例12: test_urls_with_some_content

    def test_urls_with_some_content(self):
        # Things that might tend to be in a real live system
        user = 'testuser'
        pwd = User.objects.make_random_password()
        user = User.objects.create(username=user,
                                   email='[email protected]',
                                   first_name="Test", last_name="User")
        user.set_password(pwd)
        user.save()
        experiment = Experiment.objects.create(
            title="Test Experiment",
            created_by=user,
            public_access=Experiment.PUBLIC_ACCESS_FULL)
        experiment.save()
        acl = ObjectACL(pluginId=django_user,
                        entityId=str(user.id),
                        content_object=experiment,
                        canRead=True,
                        canWrite=True,
                        canDelete=True,
                        isOwner=True)
        acl.save()
        dataset = Dataset(description="test dataset")
        dataset.save()
        dataset.experiments.add(experiment)
        dataset.save()

        # Test everything works
        c = Client()
        c.login(username=user, password=pwd)
        urls = ['/about/', '/stats/']
        urls += ['/experiment/list/%s' % part
                 for part in ('mine', 'shared', 'public')]
        # urls += ['/experiment/%s/' % part
        #          for part in ('search',)]
        urls += ['/experiment/view/%d/' % experiment.id]
        urls += ['/ajax/experiment/%d/%s' % (experiment.id, tabpane)
                 for tabpane in ('description', 'datasets', 'rights')]
        urls += ['/ajax/datafile_list/%d/' % dataset.id]
        urls += ['/ajax/dataset_metadata/%d/' % dataset.id]

        for u in urls:
            response = c.get(u)
            ensure(response.status_code, 200,
                   "%s should have returned 200 but returned %d"
                   % (u, response.status_code))

        redirect_urls = ['/experiment/list', '/experiment/view/']

        for u in redirect_urls:
            response = c.get(u)
            expect(response.status_code).to_equal(302)
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:52,代码来源:tests.py


示例13: setUp

    def setUp(self):
        # Load schemas for test
        from django.core.management import call_command
        call_command('loaddata', 'as_schemas')

        self.client = Client()
        self.experiments = []

        try:
            user = User.objects.get(username='test')
        except User.DoesNotExist:
            user = User.objects.create_user('test', '', 'test')
            user.save()

        self.userprofile = user.userprofile

        # base_path = path.abspath(path.dirname(__file__))
        experiment = Experiment(title='SAXS Test',
                                created_by=user)
        experiment.save()

        acl = ObjectACL(pluginId=django_user,
                        entityId=str(user.id),
                        content_object=experiment,
                        canRead=True,
                        canWrite=True,
                        canDelete=True,
                        isOwner=True)
        acl.save()
        self.experiments += [experiment]

        schema = Schema.objects.get(type=Schema.DATAFILE, subtype='saxs')
        parameter = ParameterName.objects.get(schema=schema, name='io')
        parameter.is_searchable = True
        parameter.save()
        self.io_param_name = parameter.getUniqueShortName()

        schema = Schema.objects.get(type=Schema.DATASET, subtype='saxs')
        parameter = ParameterName.objects.get(schema=schema, name='frqimn')
        parameter.is_searchable = True
        parameter.save()
        self.frqimn_param_name = parameter.getUniqueShortName()

        new_schema = Schema()
        new_schema.namespace = 'testschemawithduplicatename'
        new_schema.save()
        new_param = ParameterName(
            schema=new_schema,
            name='title',
            full_name='Duplicate title parametername',
            is_searchable=True)
        new_param.save()
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:52,代码来源:tests.py


示例14: create_experiment

def create_experiment(request,
                      template_name='tardis_portal/create_experiment.html'):

    """Create a new experiment view.

    :param request: a HTTP Request instance
    :type request: :class:`django.http.HttpRequest`
    :param template_name: the path of the template to render
    :type template_name: string
    :rtype: :class:`django.http.HttpResponse`

    """

    c = {
        'subtitle': 'Create Experiment',
        'user_id': request.user.id,
    }

    if request.method == 'POST':
        form = ExperimentForm(request.POST)
        if form.is_valid():
            full_experiment = form.save(commit=False)

            # group/owner assignment stuff, soon to be replaced

            experiment = full_experiment['experiment']
            experiment.created_by = request.user
            full_experiment.save_m2m()

            # add defaul ACL
            acl = ObjectACL(content_object=experiment,
                            pluginId=django_user,
                            entityId=str(request.user.id),
                            canRead=True,
                            canWrite=True,
                            canDelete=True,
                            isOwner=True,
                            aclOwnershipType=ObjectACL.OWNER_OWNED)
            acl.save()

            request.POST = {'status': "Experiment Created."}
            return HttpResponseSeeAlso(reverse('tardis_portal.view_experiment',
                                       args=[str(experiment.id)]) + "#created")

        c['status'] = "Errors exist in form."
        c["error"] = 'true'
    else:
        form = ExperimentForm(extra=1)

    c['form'] = form
    c['default_institution'] = settings.DEFAULT_INSTITUTION
    return HttpResponse(render_response_index(request, template_name, c))
开发者ID:nrmay,项目名称:mytardis,代码行数:52,代码来源:pages.py


示例15: create_experiment

 def create_experiment(i):
     experiment = Experiment(title="Text Experiment #%d" % i, institution_name="Test Uni", created_by=user)
     experiment.save()
     acl = ObjectACL(
         pluginId=django_user,
         entityId=str(user.id),
         content_object=experiment,
         canRead=True,
         isOwner=True,
         aclOwnershipType=ObjectACL.OWNER_OWNED,
     )
     acl.save()
     return experiment
开发者ID:grischa,项目名称:mytardis,代码行数:13,代码来源:test_views.py


示例16: setUp

    def setUp(self):
        """
        setting up essential objects, copied from tests above
        """

        user = 'tardis_user1'
        pwd = 'secret'
        email = ''
        self.user = User.objects.create_user(user, email, pwd)
        self.userProfile = self.user.userprofile
        self.exp = Experiment(title='test exp1',
                              institution_name='monash', created_by=self.user)
        self.exp.save()
        self.acl = ObjectACL(
            pluginId=django_user,
            entityId=str(self.user.id),
            content_object=self.exp,
            canRead=True,
            isOwner=True,
            aclOwnershipType=ObjectACL.OWNER_OWNED,
        )
        self.acl.save()
        self.dataset = Dataset(description='dataset description...')
        self.dataset.save()
        self.dataset.experiments.add(self.exp)
        self.dataset.save()

        self.datafile = DataFile(dataset=self.dataset,
                                 size=42, filename="foo",
                                 md5sum="junk")
        self.datafile.save()
开发者ID:jasonrig,项目名称:mytardis,代码行数:31,代码来源:test_views.py


示例17: add_experiment_access_group

def add_experiment_access_group(request, experiment_id, groupname):

    canRead = request.GET.get('canRead') == 'true'
    canWrite = request.GET.get('canWrite') == 'true'
    canDelete = request.GET.get('canDelete') == 'true'
    isOwner = request.GET.get('isOwner') == 'true'

    try:
        experiment = Experiment.objects.get(pk=experiment_id)
    except Experiment.DoesNotExist:
        return HttpResponse('Experiment (id=%d) does not exist' %
                            (experiment_id))

    try:
        group = Group.objects.get(name=groupname)
    except Group.DoesNotExist:
        return HttpResponse('Group %s does not exist' % (groupname))

    acl = ObjectACL.objects.filter(
        content_type=experiment.get_ct(),
        object_id=experiment.id,
        pluginId='django_group',
        entityId=str(group.id),
        aclOwnershipType=ObjectACL.OWNER_OWNED)

    if acl.count() > 0:
        # An ACL already exists for this experiment/group.
        return HttpResponse('Could not create group %s '
                            '(It is likely that it already exists)' %
                            (groupname))

    acl = ObjectACL(content_object=experiment,
                    pluginId='django_group',
                    entityId=str(group.id),
                    canRead=canRead,
                    canWrite=canWrite,
                    canDelete=canDelete,
                    isOwner=isOwner,
                    aclOwnershipType=ObjectACL.OWNER_OWNED)
    acl.save()

    c = {'group': group,
         'group_acl': acl,
         'experiment_id': experiment_id}
    return HttpResponse(render_response_index(
        request,
        'tardis_portal/ajax/add_group_result.html', c))
开发者ID:jasonrig,项目名称:mytardis,代码行数:47,代码来源:authorisation.py


示例18: setUp

    def setUp(self):
        self.ns = {'r': 'http://ands.org.au/standards/rif-cs/registryObjects',
                   'o': 'http://www.openarchives.org/OAI/2.0/'}
        user, client = _create_user_and_login()

        license_ = License(name='Creative Commons Attribution-NoDerivs 2.5 Australia',
                           url='http://creativecommons.org/licenses/by-nd/2.5/au/',
                           internal_description='CC BY 2.5 AU',
                           allows_distribution=True)
        license_.save()
        experiment = Experiment(title='Norwegian Blue',
                                description='Parrot + 40kV',
                                created_by=user)
        experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
        experiment.license = license_
        experiment.save()
        acl = ObjectACL(content_object=experiment,
                        pluginId='django_user',
                        entityId=str(user.id),
                        isOwner=False,
                        canRead=True,
                        canWrite=True,
                        canDelete=False,
                        aclOwnershipType=ObjectACL.OWNER_OWNED)
        acl.save()

        params = {'code': '010107',
                  'name': 'Mathematical Logic, Set Theory, Lattices and Universal Algebra',
                  'uri': 'http://purl.org/asc/1297.0/2008/for/010107'}
        try:
            response = client.post(\
                        reverse('tardis.apps.anzsrc_codes.views.'\
                                +'list_or_create_for_code',
                                args=[experiment.id]),
                        data=json.dumps(params),
                        content_type='application/json')
        except:  # no internet most likely
            from nose.plugins.skip import SkipTest
            raise SkipTest
        # Check related info was created
        expect(response.status_code).to_equal(201)

        self.acl = acl
        self.client = client
        self.experiment = experiment
        self.params = params
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:46,代码来源:test_oaipmh.py


示例19: setUp

    def setUp(self):
        self.ns = {'r': 'http://ands.org.au/standards/rif-cs/registryObjects',
                   'o': 'http://www.openarchives.org/OAI/2.0/'}
        user, client = _create_user_and_login()

        license_ = License(name='Creative Commons Attribution-NoDerivs '
                                '2.5 Australia',
                           url='http://creativecommons.org/licenses/by-nd/'
                               '2.5/au/',
                           internal_description='CC BY 2.5 AU',
                           allows_distribution=True)
        license_.save()
        experiment = Experiment(title='Norwegian Blue',
                                description='Parrot + 40kV',
                                created_by=user)
        experiment.public_access = Experiment.PUBLIC_ACCESS_FULL
        experiment.license = license_
        experiment.save()
        acl = ObjectACL(content_object=experiment,
                        pluginId='django_user',
                        entityId=str(user.id),
                        isOwner=False,
                        canRead=True,
                        canWrite=True,
                        canDelete=False,
                        aclOwnershipType=ObjectACL.OWNER_OWNED)
        acl.save()

        params = {'type': 'website',
                  'identifier': 'https://www.google.com/',
                  'title': 'Google',
                  'notes': 'This is a note.'}
        response = client.post(\
                    reverse('tardis.apps.related_info.views.' +
                            'list_or_create_related_info',
                            args=[experiment.id]),
                    data=json.dumps(params),
                    content_type='application/json')
        # Check related info was created
        self.assertEqual(response.status_code, 201)

        self.acl = acl
        self.client = client
        self.experiment = experiment
        self.params = params
开发者ID:mytardis,项目名称:mytardis,代码行数:45,代码来源:test_oaipmh.py


示例20: setUp

    def setUp(self):
        user, client = _create_user_and_login()

        experiment = Experiment(title='Norwegian Blue',
                                description='Parrot + 40kV',
                                created_by=user)
        experiment.save()
        acl = ObjectACL(content_object=experiment,
                        pluginId='django_user',
                        entityId=str(user.id),
                        isOwner=False,
                        canRead=True,
                        canWrite=False,
                        canDelete=False,
                        aclOwnershipType=ObjectACL.OWNER_OWNED)
        acl.save()
        self.client = client
        self.experiment = experiment
开发者ID:IntersectAustralia,项目名称:mytardis,代码行数:18,代码来源:tests.py



注:本文中的tardis.tardis_portal.models.ObjectACL类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Schema类代码示例发布时间:2022-05-27
下一篇:
Python models.Location类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap