From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001 From: Gerard Smyth <gerard.smyth@gmail.com> Date: Thu, 08 May 2014 13:09:30 -0400 Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored. --- src/test/java/com/gitblit/tests/PermissionsTest.java | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/gitblit/tests/PermissionsTest.java b/src/test/java/com/gitblit/tests/PermissionsTest.java index cffce51..46695e9 100644 --- a/src/test/java/com/gitblit/tests/PermissionsTest.java +++ b/src/test/java/com/gitblit/tests/PermissionsTest.java @@ -2508,7 +2508,7 @@ @Test public void testOwner() throws Exception { - RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date()); + RepositoryModel repository = new RepositoryModel("~jj/myrepo.git", null, null, new Date()); repository.authorizationControl = AuthorizationControl.NAMED; repository.accessRestriction = AccessRestrictionType.VIEW; @@ -2530,11 +2530,30 @@ assertFalse("owner CAN NOT delete!", user.canDelete(repository)); assertTrue("owner CAN NOT edit!", user.canEdit(repository)); + + // test personal repo owner + UserModel jj = new UserModel("jj"); + assertFalse("jj SHOULD NOT HAVE a repository permission!", jj.hasRepositoryPermission(repository.name)); + assertTrue("jj CAN NOT view!", jj.canView(repository)); + assertTrue("jj CAN NOT clone!", jj.canClone(repository)); + assertTrue("jj CAN NOT push!", jj.canPush(repository)); + + assertTrue("jj CAN NOT create ref!", jj.canCreateRef(repository)); + assertTrue("jj CAN NOT delete ref!", jj.canDeleteRef(repository)); + assertTrue("jj CAN NOT rewind ref!", jj.canRewindRef(repository)); + + assertEquals("jj has wrong permission!", AccessPermission.REWIND, jj.getRepositoryPermission(repository).permission); + + assertFalse("jj CAN fork!", jj.canFork(repository)); + + assertTrue("jj CAN NOT delete!", jj.canDelete(repository)); + assertTrue("jj CAN NOT edit!", jj.canEdit(repository)); + assertTrue(repository.isOwner(jj.username)); } @Test public void testMultipleOwners() throws Exception { - RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date()); + RepositoryModel repository = new RepositoryModel("~jj/myrepo.git", null, null, new Date()); repository.authorizationControl = AuthorizationControl.NAMED; repository.accessRestriction = AccessRestrictionType.VIEW; @@ -2579,6 +2598,25 @@ assertTrue(repository.isOwner(user.username)); assertTrue(repository.isOwner(user2.username)); + + // test personal repo owner + UserModel jj = new UserModel("jj"); + assertFalse("jj SHOULD NOT HAVE a repository permission!", jj.hasRepositoryPermission(repository.name)); + assertTrue("jj CAN NOT view!", jj.canView(repository)); + assertTrue("jj CAN NOT clone!", jj.canClone(repository)); + assertTrue("jj CAN NOT push!", jj.canPush(repository)); + + assertTrue("jj CAN NOT create ref!", jj.canCreateRef(repository)); + assertTrue("jj CAN NOT delete ref!", jj.canDeleteRef(repository)); + assertTrue("jj CAN NOT rewind ref!", jj.canRewindRef(repository)); + + assertEquals("jj has wrong permission!", AccessPermission.REWIND, jj.getRepositoryPermission(repository).permission); + + assertFalse("jj CAN fork!", jj.canFork(repository)); + + assertTrue("jj CAN NOT delete!", jj.canDelete(repository)); + assertTrue("jj CAN NOT edit!", jj.canEdit(repository)); + assertTrue(repository.isOwner(jj.username)); } @Test -- Gitblit v1.9.1