Package org.candlepin.auth.permissions

Examples of org.candlepin.auth.permissions.OwnerPermission


    public static UserPrincipal createPrincipal(String username, Owner owner,
        Access role) {
        return new UserPrincipal(
            username,
            Arrays.asList(new Permission[]{ new OwnerPermission(owner, role) }),
            false);
    }
View Full Code Here


    public Principal get() {
        TestPrincipalProviderSetter principalSingleton = TestPrincipalProviderSetter.get();
        Principal principal = principalSingleton.getPrincipal();
        if (principal == null) {
            List<Permission> permissions = new ArrayList<Permission>();
            permissions.add(new OwnerPermission(new Owner(OWNER_NAME), Access.ALL));

            principal = new UserPrincipal("Default User", permissions, true);
        }
        return principal;
    }
View Full Code Here

    }

    @Test
    public void noJobMapPrincipal() {
        List<Permission> permissions = Arrays.asList(new Permission[] {
            new OwnerPermission(new Owner("test_owner"), Access.ALL)
        });
        Principal principal = new UserPrincipal("testing", permissions, false);
        when(this.principalProvider.get()).thenReturn(principal);

        JobDetail detail = newJob().build();
View Full Code Here

    }

    @Test
    public void existingJobMapPrincipal() {
        List<Permission> permissions = Arrays.asList(new Permission[] {
            new OwnerPermission(new Owner("test_owner"), Access.ALL)
        });
        Principal principal = new UserPrincipal("testing", permissions, false);

        when(this.principalProvider.get()).thenReturn(principal);
View Full Code Here

            standardSystemType);
        toSubmit.getFacts().put(METADATA_NAME, METADATA_VALUE);
        Consumer submitted = consumerResource.create(
            toSubmit,
            new UserPrincipal(someuser.getUsername(), Arrays.asList(new Permission [] {
                new OwnerPermission(owner, Access.ALL) }), false),
            someuser.getUsername(),
            owner.getKey(), null);

        assertNotNull(submitted);
        assertNotNull(consumerCurator.find(submitted.getId()));
View Full Code Here

        Consumer toSubmit = new Consumer(CONSUMER_NAME, USER_NAME, null,
            standardSystemType);
        Consumer submitted = consumerResource.create(
            toSubmit,
            new UserPrincipal(someuser.getUsername(), Arrays.asList(new Permission [] {
                new OwnerPermission(owner, Access.ALL) }), false),
            someuser.getUsername(),
            owner.getKey(), null);

        assertEquals(DEFAULT_SERVICE_LEVEL, submitted.getServiceLevel());
View Full Code Here

        owner2Role.addUser(user);
        roleCurator.create(owner1Role);
        roleCurator.create(owner2Role);

        Set<Permission> perms = new HashSet<Permission>();
        perms.add(new OwnerPermission(owner1, Access.ALL));
        perms.add(new OwnerPermission(owner2, Access.READ_ONLY));
        Principal userPrincipal = new UserPrincipal(user.getUsername(), perms, false);

        // Requesting the list of owners for this user should assume ALL, and not
        // return owner2:
        List<Owner> owners = userResource.listUsersOwners(user.getUsername(),
View Full Code Here

        setUserAndPassword("user", "redhat");
        when(userService.validateUser("user", "redhat")).thenReturn(true);
        // TODO: test will fail, need to mock the permissions setup

        Set<OwnerPermission> permissions = new HashSet<OwnerPermission>();
        permissions.add(new OwnerPermission(owner, Access.ALL));

        when(userService.findByLogin("user")).thenReturn(new User());

        UserPrincipal expected = new UserPrincipal("user",
                new ArrayList<Permission>(permissions), false);
View Full Code Here

        setUserAndPassword("user", "1:2");
        when(userService.validateUser("user", "1:2")).thenReturn(true);


        Set<OwnerPermission> permissions = new HashSet<OwnerPermission>();
        permissions.add(new OwnerPermission(owner, Access.ALL));

        when(userService.findByLogin("user")).thenReturn(new User());

        UserPrincipal expected = new UserPrincipal("user",
                new ArrayList<Permission>(permissions), false);
View Full Code Here

        setUserNoPassword("user");
        when(userService.validateUser("user", null)).thenReturn(true);


        Set<OwnerPermission> permissions = new HashSet<OwnerPermission>();
        permissions.add(new OwnerPermission(owner, Access.ALL));

        when(userService.findByLogin("user")).thenReturn(new User());

        UserPrincipal expected = new UserPrincipal("user",
                new ArrayList<Permission>(permissions), false);
View Full Code Here

TOP

Related Classes of org.candlepin.auth.permissions.OwnerPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.