]> source.dussan.org Git - gitblit.git/commitdiff
Revised multiple owners contribution
authorJames Moger <james.moger@gitblit.com>
Wed, 23 Jan 2013 12:52:20 +0000 (07:52 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 23 Jan 2013 12:52:20 +0000 (07:52 -0500)
36 files changed:
src/com/gitblit/GitBlit.java
src/com/gitblit/GitFilter.java
src/com/gitblit/client/EditRepositoryDialog.java
src/com/gitblit/client/EditUserDialog.java
src/com/gitblit/client/GitblitClient.java
src/com/gitblit/client/JPalette.java
src/com/gitblit/client/RegistrantPermissionsPanel.java
src/com/gitblit/client/RepositoriesPanel.java
src/com/gitblit/client/RepositoriesTableModel.java
src/com/gitblit/models/RepositoryModel.java
src/com/gitblit/models/UserModel.java
src/com/gitblit/utils/ArrayUtils.java
src/com/gitblit/utils/MultiConfigUtil.java [deleted file]
src/com/gitblit/utils/StringComparator.java [deleted file]
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/GitBlitWebApp_es.properties
src/com/gitblit/wicket/GitBlitWebApp_ja.properties
src/com/gitblit/wicket/GitBlitWebApp_ko.properties
src/com/gitblit/wicket/GitBlitWebApp_nl.properties
src/com/gitblit/wicket/GitBlitWebApp_pl.properties
src/com/gitblit/wicket/GitBlitWebApp_pt_BR.properties
src/com/gitblit/wicket/pages/EditRepositoryPage.html
src/com/gitblit/wicket/pages/EditRepositoryPage.java
src/com/gitblit/wicket/pages/RepositoryPage.java
src/com/gitblit/wicket/pages/RootSubPage.java
src/com/gitblit/wicket/pages/SummaryPage.html
src/com/gitblit/wicket/pages/SummaryPage.java
src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html
src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java
src/com/gitblit/wicket/panels/RegistrantPermissionsPanel.java
src/com/gitblit/wicket/panels/RepositoriesPanel.html
src/com/gitblit/wicket/panels/RepositoriesPanel.java
tests/com/gitblit/tests/FederationTests.java
tests/com/gitblit/tests/GitServletTest.java
tests/com/gitblit/tests/PermissionsTest.java
tests/com/gitblit/tests/RpcTests.java

index a607bd84cd2b11cb01dc83fc0acdaa507d991dcf..e4d81ce73dc5e37e5d538eb675f1ddeb24eeecb6 100644 (file)
@@ -109,7 +109,6 @@ import com.gitblit.utils.HttpUtils;
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.JsonUtils;\r
 import com.gitblit.utils.MetricUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.ObjectCache;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.utils.TimeUtils;\r
@@ -181,8 +180,6 @@ public class GitBlit implements ServletContextListener {
        private TimeZone timezone;\r
        \r
        private FileBasedConfig projectConfigs;\r
-       \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
 \r
        public GitBlit() {\r
                if (gitblit == null) {\r
@@ -825,7 +822,7 @@ public class GitBlit implements ServletContextListener {
                // TODO reconsider ownership as a user property\r
                // manually specify personal repository ownerships\r
                for (RepositoryModel rm : repositoryListCache.values()) {\r
-                       if (rm.isUsersPersonalRepository(user.username) || rm.isRepoAdministrator(user.username)) {\r
+                       if (rm.isUsersPersonalRepository(user.username) || rm.isOwner(user.username)) {\r
                                RegistrantAccessPermission rp = new RegistrantAccessPermission(rm.name, AccessPermission.REWIND,\r
                                                PermissionType.OWNER, RegistrantType.REPOSITORY, null, false);\r
                                // user may be owner of a repository to which they've inherited\r
@@ -939,14 +936,14 @@ public class GitBlit implements ServletContextListener {
                        for (RepositoryModel model : getRepositoryModels(user)) {\r
                                if (model.isUsersPersonalRepository(username)) {\r
                                        // personal repository\r
-                                       model.addRepoAdministrator(user.username);\r
+                                       model.addOwner(user.username);\r
                                        String oldRepositoryName = model.name;\r
                                        model.name = "~" + user.username + model.name.substring(model.projectPath.length());\r
                                        model.projectPath = "~" + user.username;\r
                                        updateRepositoryModel(oldRepositoryName, model, false);\r
-                               } else if (model.isRepoAdministrator(username)) {\r
+                               } else if (model.isOwner(username)) {\r
                                        // common/shared repo\r
-                                       model.addRepoAdministrator(user.username);\r
+                                       model.addOwner(user.username);\r
                                        updateRepositoryModel(model.name, model, false);\r
                                }\r
                        }\r
@@ -1665,7 +1662,7 @@ public class GitBlit implements ServletContextListener {
                \r
                if (config != null) {\r
                        model.description = getConfig(config, "description", "");\r
-                       model.addRepoAdministrators(multiConfigUtil.convertStringToSet(getConfig(config, "owner", "")));\r
+                       model.addOwners(ArrayUtils.fromString(getConfig(config, "owner", "")));\r
                        model.useTickets = getConfig(config, "useTickets", false);\r
                        model.useDocs = getConfig(config, "useDocs", false);\r
                        model.allowForks = getConfig(config, "allowForks", true);\r
@@ -2172,7 +2169,7 @@ public class GitBlit implements ServletContextListener {
        public void updateConfiguration(Repository r, RepositoryModel repository) {\r
                StoredConfig config = r.getConfig();\r
                config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description);\r
-               config.setString(Constants.CONFIG_GITBLIT, null, "owner", multiConfigUtil.convertCollectionToSingleLineString(repository.getRepoAdministrators()));\r
+               config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);\r
                config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);\r
@@ -3082,15 +3079,9 @@ public class GitBlit implements ServletContextListener {
                }\r
                \r
                // schedule lucene engine\r
-               boolean branchIndexingActivated = settings.getBoolean(\r
-                               Keys.git.branchIndexingActivated, true);\r
-               logger.info("Branch indexing is "\r
-                               + (branchIndexingActivated ? "" : "not") + " activated");\r
-               if (branchIndexingActivated) {\r
-                       logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes.");\r
-                       scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2,\r
-                                       TimeUnit.MINUTES);\r
-               }\r
+               logger.info("Lucene executor is scheduled to process indexed branches every 2 minutes.");\r
+               scheduledExecutor.scheduleAtFixedRate(luceneExecutor, 1, 2, TimeUnit.MINUTES);\r
+               \r
                // schedule gc engine\r
                if (gcExecutor.isReady()) {\r
                        logger.info("GC executor is scheduled to scan repositories every 24 hours.");\r
@@ -3258,23 +3249,20 @@ public class GitBlit implements ServletContextListener {
 \r
                // create a Gitblit repository model for the clone\r
                RepositoryModel cloneModel = repository.cloneAs(cloneName);\r
-               // owner has REWIND/RW+ permissions             \r
-               cloneModel.addRepoAdministrator(user.username);\r
+               // owner has REWIND/RW+ permissions\r
+               cloneModel.addOwner(user.username);\r
                updateRepositoryModel(cloneName, cloneModel, false);\r
 \r
                // add the owner of the source repository to the clone's access list\r
-               Set<String> repoAdministrators = repository.getRepoAdministrators();\r
-               if (repoAdministrators != null) {\r
-                       for (String repoAdministrator : repoAdministrators) {\r
-                               if (!StringUtils.isEmpty(repoAdministrator)) {\r
-                                       UserModel originOwner = getUserModel(repoAdministrator);\r
-                                       if (originOwner != null) {\r
-                                               originOwner.setRepositoryPermission(cloneName, AccessPermission.CLONE);\r
-                                               updateUserModel(originOwner.username, originOwner, false);\r
-                                       }\r
+               if (!ArrayUtils.isEmpty(repository.owners)) {\r
+                       for (String owner : repository.owners) {\r
+                               UserModel originOwner = getUserModel(owner);\r
+                               if (originOwner != null) {\r
+                                       originOwner.setRepositoryPermission(cloneName, AccessPermission.CLONE);\r
+                                       updateUserModel(originOwner.username, originOwner, false);\r
                                }\r
                        }\r
-               }               \r
+               }\r
 \r
                // grant origin's user list clone permission to fork\r
                List<String> users = getRepositoryUsers(repository);\r
index 82b37dc6044d58969056d97c37db70739d7c6349..a0d395b1a7dc794bbc3d75b12b6b9a94c5c3a03f 100644 (file)
@@ -222,7 +222,7 @@ public class GitFilter extends AccessRestrictionFilter {
                                // create repository\r
                                RepositoryModel model = new RepositoryModel();\r
                                model.name = repository;\r
-                               model.addRepoAdministrator(user.username);\r
+                               model.addOwner(user.username);\r
                                model.projectPath = StringUtils.getFirstPathElement(repository);\r
                                if (model.isUsersPersonalRepository(user.username)) {\r
                                        // personal repository, default to private for user\r
index 5c03ff824d9f7fc19e12adc273a68f0ffd59024b..8851de430cc5d92245f1d8885c79038d6feadf9c 100644 (file)
@@ -38,7 +38,6 @@ import java.util.Set;
 \r
 import javax.swing.BoxLayout;\r
 import javax.swing.ButtonGroup;\r
-import javax.swing.DefaultComboBoxModel;\r
 import javax.swing.DefaultListCellRenderer;\r
 import javax.swing.ImageIcon;\r
 import javax.swing.JButton;\r
@@ -117,7 +116,7 @@ public class EditRepositoryDialog extends JDialog {
 \r
        private JComboBox federationStrategy;\r
 \r
-       private JComboBox ownerField;\r
+       private JPalette<String> ownersPalette;\r
 \r
        private JComboBox headRefField;\r
        \r
@@ -126,7 +125,7 @@ public class EditRepositoryDialog extends JDialog {
        private JTextField gcThreshold;\r
        \r
        private JComboBox maxActivityCommits;\r
-\r
+       \r
        private RegistrantPermissionsPanel usersPalette;\r
 \r
        private JPalette<String> setsPalette;\r
@@ -207,7 +206,7 @@ public class EditRepositoryDialog extends JDialog {
                gcThreshold = new JTextField(8);\r
                gcThreshold.setText(anRepository.gcThreshold);\r
 \r
-               ownerField = new JComboBox();\r
+               ownersPalette = new JPalette<String>(true);\r
 \r
                useTickets = new JCheckBox(Translation.get("gb.useTicketsDescription"),\r
                                anRepository.useTickets);\r
@@ -334,10 +333,10 @@ public class EditRepositoryDialog extends JDialog {
 \r
                usersPalette = new RegistrantPermissionsPanel(RegistrantType.USER);\r
 \r
-               JPanel northFieldsPanel = new JPanel(new GridLayout(0, 1, 0, 5));\r
-               northFieldsPanel.add(newFieldPanel(Translation.get("gb.repoAdministrators"), ownerField));\r
+               JPanel northFieldsPanel = new JPanel(new BorderLayout(0, 5));\r
+               northFieldsPanel.add(newFieldPanel(Translation.get("gb.owners"), ownersPalette), BorderLayout.NORTH);\r
                northFieldsPanel.add(newFieldPanel(Translation.get("gb.accessRestriction"),\r
-                               accessRestriction), BorderLayout.NORTH);\r
+                               accessRestriction), BorderLayout.CENTER);\r
 \r
                JPanel northAccessPanel = new JPanel(new BorderLayout(5, 5));\r
                northAccessPanel.add(northFieldsPanel, BorderLayout.NORTH);\r
@@ -556,8 +555,8 @@ public class EditRepositoryDialog extends JDialog {
 \r
                repository.name = rname;\r
                repository.description = descriptionField.getText();\r
-               repository.addRepoAdministrator(ownerField.getSelectedItem() == null ? null\r
-                               : ownerField.getSelectedItem().toString());\r
+               repository.owners.clear();\r
+               repository.owners.addAll(ownersPalette.getSelections());\r
                repository.HEAD = headRefField.getSelectedItem() == null ? null\r
                                : headRefField.getSelectedItem().toString();\r
                repository.gcPeriod = (Integer) gcPeriod.getSelectedItem();\r
@@ -629,11 +628,8 @@ public class EditRepositoryDialog extends JDialog {
                this.allowNamed.setSelected(!authenticated);\r
        }\r
 \r
-       public void setUsers(String owner, List<String> all, List<RegistrantAccessPermission> permissions) {\r
-               ownerField.setModel(new DefaultComboBoxModel(all.toArray()));\r
-               if (!StringUtils.isEmpty(owner)) {\r
-                       ownerField.setSelectedItem(owner);\r
-               }\r
+       public void setUsers(List<String> owners, List<String> all, List<RegistrantAccessPermission> permissions) {\r
+               ownersPalette.setObjects(all, owners);\r
                usersPalette.setObjects(all, permissions);\r
        }\r
 \r
index cb04b315ff54de7b2061c651874eee52e76d24dd..0400f5c9eaab01157f89a17cf8ac2af82c2a0e87 100644 (file)
@@ -389,7 +389,7 @@ public class EditUserDialog extends JDialog {
                List<String> restricted = new ArrayList<String>();\r
                for (RepositoryModel repo : repositories) {\r
                        // exclude Owner or personal repositories\r
-                       if (!repo.isRepoAdministrator(username) && !repo.isUsersPersonalRepository(username)) {\r
+                       if (!repo.isOwner(username) && !repo.isUsersPersonalRepository(username)) {\r
                                if (repo.accessRestriction.exceeds(AccessRestrictionType.NONE)\r
                                                && repo.authorizationControl.equals(AuthorizationControl.NAMED)) {\r
                                        restricted.add(repo.name);\r
@@ -438,7 +438,7 @@ public class EditUserDialog extends JDialog {
                                        permission.mutable = false;\r
                                        continue;\r
                                }\r
-                               boolean isOwner = rm.isRepoAdministrator(username);\r
+                               boolean isOwner = rm.isOwner(username);\r
                                if (isOwner) {\r
                                        permission.permissionType = PermissionType.OWNER;\r
                                        permission.mutable = false;\r
index 01db46e5b90749d186118125dd57a104f8899e9b..cc7d58a6720b1a6e0638f38e298fd5c9eebae472 100644 (file)
@@ -162,7 +162,7 @@ public class GitblitClient implements Serializable {
        }\r
 \r
        public boolean isOwner(RepositoryModel model) {\r
-               return model.isRepoAdministrator(account);\r
+               return model.isOwner(account);\r
        }\r
 \r
        public String getURL(String action, String repository, String objectId) {\r
@@ -532,7 +532,7 @@ public class GitblitClient implements Serializable {
                // TODO reconsider ownership as a user property\r
                // manually specify personal repository ownerships\r
                for (RepositoryModel rm : allRepositories) {\r
-                       if (rm.isUsersPersonalRepository(user.username) || rm.isRepoAdministrator(user.username)) {\r
+                       if (rm.isUsersPersonalRepository(user.username) || rm.isOwner(user.username)) {\r
                                RegistrantAccessPermission rp = new RegistrantAccessPermission(rm.name, AccessPermission.REWIND,\r
                                                PermissionType.OWNER, RegistrantType.REPOSITORY, null, false);\r
                                // user may be owner of a repository to which they've inherited\r
index 4ead099eeeebac811855756da96247f0aee0221b..a0c2b258d7697dfb2e2e790cdbfb663f3c33ec5f 100644 (file)
@@ -144,7 +144,7 @@ public class JPalette<T> extends JPanel {
                table.getColumn(table.getColumnName(0)).setCellRenderer(nameRenderer);\r
 \r
                JScrollPane jsp = new JScrollPane(table);\r
-               jsp.setPreferredSize(new Dimension(225, 175));\r
+               jsp.setPreferredSize(new Dimension(225, 160));\r
                JPanel panel = new JPanel(new BorderLayout());\r
                JLabel jlabel = new JLabel(label);\r
                jlabel.setFont(jlabel.getFont().deriveFont(Font.BOLD));\r
index 46ba689ca586f9418c62dd222fccd643bec436ca..98dbfb72e061e8dc6aaed281cbb2a8ab9e0413f8 100644 (file)
@@ -209,8 +209,8 @@ public class RegistrantPermissionsPanel extends JPanel {
                                setToolTipText(Translation.get("gb.administratorPermission"));\r
                                break;\r
                        case OWNER:\r
-                               setText(Translation.get("gb.repoAdministrators"));\r
-                               setToolTipText(Translation.get("gb.repoAdministratorPermission"));\r
+                               setText(Translation.get("gb.owner"));\r
+                               setToolTipText(Translation.get("gb.ownerPermission"));\r
                                break;\r
                        case TEAM:\r
                                setText(ap.source == null ? Translation.get("gb.team") : ap.source);\r
index 6700b21ab01c5610d9e56bcf43c106fe7199d594..64bde9b872f9b2f62f17212cd84eae0a644126d6 100644 (file)
@@ -49,10 +49,9 @@ import javax.swing.table.TableRowSorter;
 import com.gitblit.Constants;\r
 import com.gitblit.Constants.RpcRequest;\r
 import com.gitblit.Keys;\r
-import com.gitblit.models.RegistrantAccessPermission;\r
 import com.gitblit.models.FeedModel;\r
+import com.gitblit.models.RegistrantAccessPermission;\r
 import com.gitblit.models.RepositoryModel;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.StringUtils;\r
 \r
 /**\r
@@ -85,8 +84,6 @@ public abstract class RepositoriesPanel extends JPanel {
        private JTextField filterTextfield;\r
 \r
        private JButton clearCache;\r
-       \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
 \r
        public RepositoriesPanel(GitblitClient gitblit) {\r
                super();\r
@@ -456,7 +453,7 @@ public abstract class RepositoriesPanel extends JPanel {
                dialog.setLocationRelativeTo(RepositoriesPanel.this);\r
                List<String> usernames = gitblit.getUsernames();\r
                List<RegistrantAccessPermission> members = gitblit.getUserAccessPermissions(repository);\r
-               dialog.setUsers(multiConfigUtil.convertCollectionToSingleLineString(repository.getRepoAdministrators()), usernames, members);\r
+               dialog.setUsers(new ArrayList<String>(repository.owners), usernames, members);\r
                dialog.setTeams(gitblit.getTeamnames(), gitblit.getTeamAccessPermissions(repository));\r
                dialog.setRepositories(gitblit.getRepositories());\r
                dialog.setFederationSets(gitblit.getFederationSets(), repository.federationSets);\r
index 65f49ca0a1a39f1f8fac348fa811121fa28276bd..6b295a4bd9c49155ead9c2bced21103c1f135436 100644 (file)
@@ -23,6 +23,7 @@ import java.util.List;
 import javax.swing.table.AbstractTableModel;\r
 \r
 import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.utils.ArrayUtils;\r
 \r
 /**\r
  * Table model of a list of repositories.\r
@@ -73,7 +74,7 @@ public class RepositoriesTableModel extends AbstractTableModel {
                case Description:\r
                        return Translation.get("gb.description");\r
                case Owner:\r
-                       return Translation.get("gb.repoAdministrators");\r
+                       return Translation.get("gb.owner");\r
                case Last_Change:\r
                        return Translation.get("gb.lastChange");\r
                case Size:\r
@@ -111,7 +112,7 @@ public class RepositoriesTableModel extends AbstractTableModel {
                case Description:\r
                        return model.description;\r
                case Owner:\r
-                       return model.getRepoAdministrators();\r
+                       return ArrayUtils.toString(model.owners);\r
                case Indicators:\r
                        return model;\r
                case Last_Change:\r
index a27e9fdba0d0faac08160d6c9ff6b6dcbcdc349a..320f16b5745957687b2ac7a0078a033e099f73bc 100644 (file)
@@ -17,20 +17,17 @@ package com.gitblit.models;
 \r
 import java.io.Serializable;\r
 import java.util.ArrayList;\r
+import java.util.Collection;\r
 import java.util.Date;\r
 import java.util.List;\r
 import java.util.Map;\r
 import java.util.Set;\r
 import java.util.TreeSet;\r
 \r
-import org.apache.wicket.markup.html.basic.MultiLineLabel;\r
-\r
 import com.gitblit.Constants.AccessRestrictionType;\r
 import com.gitblit.Constants.AuthorizationControl;\r
 import com.gitblit.Constants.FederationStrategy;\r
 import com.gitblit.utils.ArrayUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
-import com.gitblit.utils.StringComparator;\r
 import com.gitblit.utils.StringUtils;\r
 \r
 /**\r
@@ -40,15 +37,14 @@ import com.gitblit.utils.StringUtils;
  * @author James Moger\r
  * \r
  */\r
-public class RepositoryModel implements Serializable,\r
-               Comparable<RepositoryModel> {\r
+public class RepositoryModel implements Serializable, Comparable<RepositoryModel> {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
        // field names are reflectively mapped in EditRepository page\r
        public String name;\r
        public String description;\r
-       private Set<String> repoAdministrators = new TreeSet<String>(new StringComparator());\r
+       public List<String> owners;\r
        public Date lastChange;\r
        public boolean hasCommits;\r
        public boolean showRemoteBranches;\r
@@ -84,29 +80,28 @@ public class RepositoryModel implements Serializable,
        public String gcThreshold;\r
        public int gcPeriod;\r
        public int maxActivityCommits;\r
-\r
+       \r
        public transient boolean isCollectingGarbage;\r
        public Date lastGC;\r
-\r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-\r
+       \r
        public RepositoryModel() {\r
                this("", "", "", new Date(0));\r
        }\r
 \r
-       public RepositoryModel(String name, String description, String owner,\r
-                       Date lastchange) {\r
+       public RepositoryModel(String name, String description, String owner, Date lastchange) {\r
                this.name = name;\r
-               this.description = description;         \r
-               this.addRepoAdministrator(owner);\r
+               this.description = description;\r
                this.lastChange = lastchange;\r
                this.accessRestriction = AccessRestrictionType.NONE;\r
                this.authorizationControl = AuthorizationControl.NAMED;\r
                this.federationSets = new ArrayList<String>();\r
-               this.federationStrategy = FederationStrategy.FEDERATE_THIS;\r
+               this.federationStrategy = FederationStrategy.FEDERATE_THIS;     \r
                this.projectPath = StringUtils.getFirstPathElement(name);\r
+               this.owners = new ArrayList<String>();\r
+               \r
+               addOwner(owner);\r
        }\r
-\r
+       \r
        public List<String> getLocalBranches() {\r
                if (ArrayUtils.isEmpty(availableRefs)) {\r
                        return new ArrayList<String>();\r
@@ -119,30 +114,30 @@ public class RepositoryModel implements Serializable,
                }\r
                return localBranches;\r
        }\r
-\r
+       \r
        public void addFork(String repository) {\r
                if (forks == null) {\r
                        forks = new TreeSet<String>();\r
                }\r
                forks.add(repository);\r
        }\r
-\r
+       \r
        public void removeFork(String repository) {\r
                if (forks == null) {\r
                        return;\r
                }\r
                forks.remove(repository);\r
        }\r
-\r
+       \r
        public void resetDisplayName() {\r
                displayName = null;\r
        }\r
-\r
+       \r
        @Override\r
        public int hashCode() {\r
                return name.hashCode();\r
        }\r
-\r
+       \r
        @Override\r
        public boolean equals(Object o) {\r
                if (o instanceof RepositoryModel) {\r
@@ -163,25 +158,30 @@ public class RepositoryModel implements Serializable,
        public int compareTo(RepositoryModel o) {\r
                return StringUtils.compareRepositoryNames(name, o.name);\r
        }\r
-\r
+       \r
        public boolean isFork() {\r
                return !StringUtils.isEmpty(originRepository);\r
        }\r
-\r
+       \r
+       public boolean isOwner(String username) {\r
+               if (StringUtils.isEmpty(username) || ArrayUtils.isEmpty(owners)) {\r
+                       return false;\r
+               }\r
+               return owners.contains(username.toLowerCase());\r
+       }\r
+       \r
        public boolean isPersonalRepository() {\r
-               return !StringUtils.isEmpty(projectPath)\r
-                               && projectPath.charAt(0) == '~';\r
+               return !StringUtils.isEmpty(projectPath) && projectPath.charAt(0) == '~';\r
        }\r
-\r
+       \r
        public boolean isUsersPersonalRepository(String username) {\r
-               return !StringUtils.isEmpty(projectPath)\r
-                               && projectPath.equalsIgnoreCase("~" + username);\r
+               return !StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase("~" + username);\r
        }\r
-\r
+       \r
        public boolean allowAnonymousView() {\r
                return !accessRestriction.atLeast(AccessRestrictionType.VIEW);\r
        }\r
-\r
+       \r
        public RepositoryModel cloneAs(String cloneName) {\r
                RepositoryModel clone = new RepositoryModel();\r
                clone.originRepository = name;\r
@@ -202,46 +202,36 @@ public class RepositoryModel implements Serializable,
                return clone;\r
        }\r
 \r
-       public void addRepoAdministrator(String repoAdministrator) {\r
-               if (repoAdministrator != null && repoAdministrator.trim().length() > 0) {\r
-                       this.repoAdministrators.add(repoAdministrator.toLowerCase());\r
+       public void addOwner(String username) {\r
+               if (!StringUtils.isEmpty(username)) {\r
+                       String name = username.toLowerCase();\r
+                       // a set would be more efficient, but this complicates JSON\r
+                       // deserialization so we enforce uniqueness with an arraylist\r
+                       if (!owners.contains(name)) {\r
+                               owners.add(name);\r
+                       }\r
                }\r
        }\r
 \r
-       public void removeRepoAdministrator(String repoAdministrator) {\r
-               if (repoAdministrator != null && repoAdministrator.trim().length() > 0) {\r
-                       this.repoAdministrators.remove(repoAdministrator.toLowerCase());\r
+       public void removeOwner(String username) {\r
+               if (!StringUtils.isEmpty(username)) {\r
+                       owners.remove(username.toLowerCase());\r
                }\r
        }\r
 \r
-       public void addRepoAdministrators(Set<String> repoAdministrators) {\r
-               if (repoAdministrators != null) {\r
-                       for (String admin : repoAdministrators) {\r
-                               this.addRepoAdministrator(admin);\r
+       public void addOwners(Collection<String> usernames) {\r
+               if (!ArrayUtils.isEmpty(usernames)) {\r
+                       for (String username : usernames) {\r
+                               addOwner(username);\r
                        }\r
                }\r
        }\r
 \r
-       public void removeRepoAdministrators(Set<String> repoAdministrators) {\r
-               if (repoAdministrators != null) {\r
-                       for (String admin : repoAdministrators) {\r
-                               this.removeRepoAdministrator(admin);\r
+       public void removeOwners(Collection<String> usernames) {\r
+               if (!ArrayUtils.isEmpty(owners)) {\r
+                       for (String username : usernames) {\r
+                               removeOwner(username);\r
                        }\r
                }\r
        }\r
-\r
-       public void removeAllRepoAdministrators() {\r
-               this.repoAdministrators.clear();\r
-       }\r
-       \r
-       public Set<String> getRepoAdministrators() {\r
-               return this.repoAdministrators;\r
-       }\r
-       \r
-       public boolean isRepoAdministrator(String username) {\r
-               if (username == null || username.trim().length() == 0) {\r
-                       return false;\r
-               }\r
-               return this.repoAdministrators.contains(username.toLowerCase());\r
-       }\r
 }
\ No newline at end of file
index c513febc6954bf27b0f611d6d9702360951e170e..bec011d93f139bd8180bb031bee95c0eab692030 100644 (file)
@@ -108,7 +108,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
        @Deprecated\r
        @Unused\r
        public boolean canAccessRepository(RepositoryModel repository) {\r
-               boolean isOwner = repository.isRepoAdministrator(username);\r
+               boolean isOwner = repository.isOwner(username);\r
                boolean allowAuthenticated = isAuthenticated && AuthorizationControl.AUTHENTICATED.equals(repository.authorizationControl);\r
                return canAdmin() || isOwner || repositories.contains(repository.name.toLowerCase())\r
                                || hasTeamAccess(repository.name) || allowAuthenticated;\r
@@ -303,7 +303,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
                }\r
                \r
                // repository owner - either specified owner or personal repository\r
-               if (repository.isRepoAdministrator(username) || repository.isUsersPersonalRepository(username)) {\r
+               if (repository.isOwner(username) || repository.isUsersPersonalRepository(username)) {\r
                        ap.permissionType = PermissionType.OWNER;\r
                        ap.permission = AccessPermission.REWIND;\r
                        return ap;\r
@@ -411,7 +411,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
                        // can not fork your own repository\r
                        return false;\r
                }\r
-               if (canAdmin() || repository.isRepoAdministrator(username)) {\r
+               if (canAdmin() || repository.isOwner(username)) {\r
                        return true;\r
                }\r
                if (!repository.allowForks) {\r
@@ -428,7 +428,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
        }\r
        \r
        public boolean canEdit(RepositoryModel model) {\r
-               return canAdmin() || model.isUsersPersonalRepository(username) || model.isRepoAdministrator(username);\r
+               return canAdmin() || model.isUsersPersonalRepository(username) || model.isOwner(username);\r
        }\r
        \r
        /**\r
index 41d110a34165ae91d5c50e1ef2d8f401768f76bc..65834673efb24d24eed0cd8aa3d7476da801fc33 100644 (file)
@@ -15,7 +15,9 @@
  */\r
 package com.gitblit.utils;\r
 \r
+import java.util.ArrayList;\r
 import java.util.Collection;\r
+import java.util.List;\r
 \r
 \r
 /**\r
@@ -41,4 +43,32 @@ public class ArrayUtils {
        public static boolean isEmpty(Collection<?> collection) {\r
                return collection == null || collection.size() == 0;\r
        }\r
+       \r
+       public static String toString(Collection<?> collection) {\r
+               if (isEmpty(collection)) {\r
+                       return "";\r
+               }\r
+               StringBuilder sb = new StringBuilder();\r
+               for (Object o : collection) {\r
+                       sb.append(o.toString()).append(", ");\r
+               }\r
+               // trim trailing comma-space\r
+               sb.setLength(sb.length() - 2);\r
+               return sb.toString();\r
+       }\r
+       \r
+       public static Collection<String> fromString(String value) {\r
+               if (StringUtils.isEmpty(value)) {\r
+                       value = "";\r
+               }\r
+               List<String> list = new ArrayList<String>();\r
+               String [] values = value.split(",|;");\r
+               for (String v : values) {\r
+                       String string = v.trim();\r
+                       if (!StringUtils.isEmpty(string)) {\r
+                               list.add(string);\r
+                       }\r
+               }\r
+               return list;\r
+       }\r
 }\r
diff --git a/src/com/gitblit/utils/MultiConfigUtil.java b/src/com/gitblit/utils/MultiConfigUtil.java
deleted file mode 100644 (file)
index 1ed8122..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit.utils;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Utility class to convert Strings into Collections and vice versa.
- * 
- * @author saheba
- *
- */
-public class MultiConfigUtil implements Serializable {
-       private static final long serialVersionUID = 1324076956473037856L;
-
-       public static final String OPTION_SEPARATOR = ";";
-
-       /**
-        * converts a collection of strings into a single line string by concatenating them and separating the different elements with the OPTION_SEPARATOR 
-        * 
-        * @param collection of strings
-        * 
-        * @return
-        */
-       public String convertCollectionToSingleLineString(Collection<String> collection) {
-               String result = "";
-               for (String string : collection) {
-                       if (!result.equals("")) {
-                               result += OPTION_SEPARATOR;
-                       }
-                       result += string;
-               }
-               return result;
-       }
-       
-       /**
-        * converts a collection of strings into a list of strings 
-        * 
-        * @param collection
-        * 
-        * @return
-        */
-       public List<String> convertCollectionToList(Collection<String> collection) {
-               List<String> result = new ArrayList<String>();
-               for (String string : collection) {
-                               result.add(string);
-               }
-               return result;
-       }
-
-       /**
-        * converts a single line string into a set of strings by splitting the given string with the OPTION_SEPARATOR 
-        * 
-        * @param string which contains one or more options concatenated with the OPTION_SEPARATOR
-        * 
-        * @return
-        */
-       public Set<String> convertStringToSet(String string) {
-               Set<String> result = new HashSet<String>();
-               if (string != null && string.trim().length() > 0) {
-                       String[] splitted = string.split(OPTION_SEPARATOR);
-                       for (int i = 0; i < splitted.length; i++) {
-                               String possible = splitted[i].trim();
-                               if (possible.length() > 0) {
-                                       result.add(possible);
-                               }
-                       }
-               }
-               return result;
-       }
-}
diff --git a/src/com/gitblit/utils/StringComparator.java b/src/com/gitblit/utils/StringComparator.java
deleted file mode 100644 (file)
index da9b347..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.gitblit.utils;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * A comparator for {@link java.util.TreeSet} that sorts strings ascending inside the {@link java.util.TreeSet}  
- * 
- * @author saheba
- *
- */
-public class StringComparator implements Comparator<String>, Serializable {
-       private static final long serialVersionUID = 7563266118711225424L;
-
-       /* (non-Javadoc)
-        * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
-        */
-       @Override
-       public int compare(String o1, String o2) {
-               // TODO Auto-generated method stub
-               return o1.compareTo(o2);
-       }
-
-}
index d601e1efdd31bc290530eeb696d0319918768d8b..e77597608098a6a75148aa177614babe4a5b764a 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = repository\r
-gb.repoAdministrators = repository administrators\r
+gb.owner = owner\r
 gb.description = description\r
 gb.lastChange = last change\r
 gb.refs = refs\r
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = show readme\r
 gb.showReadmeDescription = show a \"readme\" Markdown file on the summary page\r
 gb.nameDescription = use '/' to group repositories.  e.g. libraries/mycoollib.git\r
-gb.repoAdministratorsDescription = the repository administrators may edit repository settings\r
+gb.ownerDescription = the owner may edit repository settings\r
 gb.blob = blob\r
 gb.commitActivityTrend = commit activity trend\r
 gb.commitActivityDOW = commit activity by day of week\r
@@ -279,7 +279,7 @@ gb.displayName = display name
 gb.emailAddress = email address\r
 gb.errorAdminLoginRequired = Administration requires a login\r
 gb.errorOnlyAdminMayCreateRepository = Only an administrator may create a repository\r
-gb.errorOnlyAdminOrRepoAdminMayEditRepository = Only an administrator or a repository administrator may edit a repository\r
+gb.errorOnlyAdminOrOwnerMayEditRepository = Only an administrator or the owner may edit a repository\r
 gb.errorAdministrationDisabled = Administration is disabled\r
 gb.lastNDays = last {0} days\r
 gb.completeGravatarProfile = Complete profile on Gravatar.com\r
@@ -364,7 +364,7 @@ gb.gcPeriod = GC period
 gb.gcPeriodDescription = duration between garbage collections\r
 gb.gcThreshold = GC threshold\r
 gb.gcThresholdDescription = minimum total size of loose objects to trigger early garbage collection\r
-gb.repoAdministratorPermission = repository administrator\r
+gb.ownerPermission = repository owner\r
 gb.administrator = admin\r
 gb.administratorPermission = Gitblit administrator\r
 gb.team = team\r
@@ -440,4 +440,5 @@ gb.sslCertificateGeneratedRestart = Successfully generated new server SSL certif
 gb.validity = validity\r
 gb.siteName = site name\r
 gb.siteNameDescription = short, descriptive name of your server \r
-gb.excludeFromActivity = exclude from activity page
\ No newline at end of file
+gb.excludeFromActivity = exclude from activity page\r
+gb.owners = owners
\ No newline at end of file
index 478a0ab6a1c6eb75c275ed5d93a364bd5e095f66..64c9ca13bd87a6b30d5b31cab7c8f48c2ba0b9a0 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = Repositorio\r
-gb.repoAdministrators = Administradores del repositorio\r
+gb.owner = Propietario\r
 gb.description = Descripci\u00F3n\r
 gb.lastChange = Actualizado\r
 gb.refs = Refs\r
@@ -94,7 +94,7 @@ gb.zip = Zip
 gb.showReadme = Ver l\u00E9eme\r
 gb.showReadmeDescription = Mostrar el archivo \"l\u00E9eme\" de Markdown en la p\u00E1gina resumen\r
 gb.nameDescription = Usa '/' para agrupar repositorios. ej. librerias/mylibreria.git\r
-gb.repoAdministratorsDescription = Administradores del repositorio puede editar la configuraci\u00F3n del repositorio\r
+gb.ownerDescription = El propietario puede editar la configuraci\u00F3n del repositorio\r
 gb.blob = Objeto\r
 gb.commitActivityTrend = Tendencia de actividad del repositorio\r
 gb.commitActivityDOW = Actividad de consignas por d\u00EDa de la semana\r
@@ -364,7 +364,7 @@ gb.gcPeriod = Periodo para GC
 gb.gcPeriodDescription = Duraci\u00F3n entre periodos de limpieza\r
 gb.gcThreshold = L\u00EDmites para GC\r
 gb.gcThresholdDescription = Tama\u00F1o m\u00EDnimo total de objetos sueltos para activar la recolecci\u00F3n inmediata de basura\r
-gb.repoAdministratorPermission = Administrador del repositorio\r
+gb.ownerPermission = Propietario del repositorio\r
 gb.administrator = Admin\r
 gb.administratorPermission = Administrador de Gitblit\r
 gb.team = Equipo\r
index d4e351183a46804e20d12806536dc8228bcebf28..086df7b7d8e814dafbf661a984bad1bf8843483c 100755 (executable)
@@ -1,5 +1,5 @@
 gb.repository = \u30ea\u30dd\u30b8\u30c8\u30ea\r
-gb.repoAdministrators = \u30EA\u30DD\u30B8\u30C8\u30EA\u7BA1\u7406\u8005\r
+gb.owner = \u6240\u6709\u8005\r
 gb.description = \u8aac\u660e\r
 gb.lastChange = \u6700\u5f8c\u306e\u5909\u66f4\r
 gb.refs = refs\r
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = readme\u8868\u793a\r
 gb.showReadmeDescription = \"readme\" Markdown\u30d5\u30a1\u30a4\u30eb\u3092\u6982\u8981\u30da\u30fc\u30b8\u306b\u8868\u793a\u3059\u308b\r
 gb.nameDescription = \u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3059\u308b\u306b\u306f '/' \u3092\u4f7f\u3046\u3002 e.g. libraries/mycoollib.git\r
-gb.repoAdministratorsDescription = \u30EA\u30DD\u30B8\u30C8\u30EA\u7BA1\u7406\u8005\u306f\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3067\u304d\u308b\r
+gb.ownerDescription = \u6240\u6709\u8005\u306f\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3067\u304d\u308b\r
 gb.blob = blob\r
 gb.commitActivityTrend = commit activity trend\r
 gb.commitActivityDOW = commit activity by day of week\r
@@ -279,7 +279,7 @@ gb.displayName = display name
 gb.emailAddress = email address\r
 gb.errorAdminLoginRequired = Administration requires a login\r
 gb.errorOnlyAdminMayCreateRepository = Only an administrator may create a repository\r
-gb.errorOnlyAdminOrRepoAdminMayEditRepository = Only an administrator or a repository administrator may edit a repository\r
+gb.errorOnlyAdminOrOwnerMayEditRepository = Only an administrator or the owner may edit a repository\r
 gb.errorAdministrationDisabled = Administration is disabled\r
 gb.lastNDays = last {0} days\r
 gb.completeGravatarProfile = Complete profile on Gravatar.com\r
index bff593daba5259cdad5ab8db92c079c323a9c838..18eda26c74b677b3f5adbd96e93924e4a2b195e7 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = \uC800\uC7A5\uC18C
-gb.repoAdministrators = \uC800\uC7A5\uC18C \uAD00\uB9AC\uC790
+gb.owner = \uC18C\uC720\uC790
 gb.description = \uC124\uBA85
 gb.lastChange = \uCD5C\uADFC \uBCC0\uACBD
 gb.refs = refs
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = \uB9AC\uB4DC\uBBF8(readme) \uBCF4\uAE30
 gb.showReadmeDescription = \uC694\uC57D\uD398\uC774\uC9C0\uC5D0\uC11C \"readme\" \uB9C8\uD06C\uB2E4\uC6B4 \uD30C\uC77C \uBCF4\uAE30
 gb.nameDescription = \uC800\uC7A5\uC18C\uB97C \uADF8\uB8F9\uC73C\uB85C \uBB36\uC73C\uB824\uBA74 '/' \uB97C \uC0AC\uC6A9. \uC608) libraries/reponame.git
-gb.repoAdministratorsDescription = \uC800\uC7A5\uC18C \uAD00\uB9AC\uC790 \uC800\uC7A5\uC18C \uC124\uC815\uC744 \uBCC0\uACBD\uD560 \uC218 \uC788\uC74C
+gb.ownerDescription = \uC18C\uC720\uC790\uB294 \uC800\uC7A5\uC18C \uC124\uC815\uC744 \uBCC0\uACBD\uD560 \uC218 \uC788\uC74C
 gb.blob = blob
 gb.commitActivityTrend = \uCEE4\uBC0B \uD65C\uB3D9 \uD2B8\uB79C\uB4DC
 gb.commitActivityDOW = 1\uC8FC\uC77C\uC758 \uC77C\uB2E8\uC704 \uCEE4\uBC0B \uD65C\uB3D9
@@ -279,7 +279,7 @@ gb.displayName = \uD45C\uC2DC\uB418\uB294 \uC774\uB984
 gb.emailAddress = \uC774\uBA54\uC77C \uC8FC\uC18C
 gb.errorAdminLoginRequired = \uAD00\uB9AC\uB97C \uC704\uD574\uC11C\uB294 \uB85C\uADF8\uC778\uC774 \uD544\uC694
 gb.errorOnlyAdminMayCreateRepository = \uAD00\uB9AC\uC790\uB9CC \uC800\uC7A5\uC18C\uB97C \uB9CC\uB4E4\uC218 \uC788\uC74C
-gb.errorOnlyAdminOrRepoAdminMayEditRepository = \uAD00\uB9AC\uC790\uC640 \uC800\uC7A5\uC18C \uAD00\uB9AC\uC790\uB9CC \uC800\uC7A5\uC18C\uB97C \uC218\uC815\uD560 \uC218 \uC788\uC74C
+gb.errorOnlyAdminOrOwnerMayEditRepository = \uAD00\uB9AC\uC790\uC640 \uC18C\uC720\uC790\uB9CC \uC800\uC7A5\uC18C\uB97C \uC218\uC815\uD560 \uC218 \uC788\uC74C
 gb.errorAdministrationDisabled = \uAD00\uB9AC\uAE30\uB2A5 \uBE44\uD65C\uC131\uD654\uB428
 gb.lastNDays = {0} \uC77C\uC804
 gb.completeGravatarProfile = Gravatar.com \uC5D0 \uD504\uB85C\uD30C\uC77C \uC0DD\uC131\uB428
@@ -364,7 +364,7 @@ gb.gcPeriod = GC \uC8FC\uAE30
 gb.gcPeriodDescription = \uAC00\uBE44\uC9C0 \uD074\uB809\uC158\uAC04\uC758 \uC2DC\uAC04 \uAC04\uACA9
 gb.gcThreshold = GC \uAE30\uC900\uC810
 gb.gcThresholdDescription = \uC870\uAE30 \uAC00\uBE44\uC9C0 \uCEEC\uB809\uC158\uC744 \uBC1C\uC0DD\uC2DC\uD0A4\uAE30 \uC704\uD55C \uC624\uBE0C\uC81D\uD2B8\uB4E4\uC758 \uCD5C\uC18C \uC804\uCCB4 \uD06C\uAE30
-gb.repoAdministratorPermission = \uC800\uC7A5\uC18C \uAD00\uB9AC\uC790
+gb.ownerPermission = \uC800\uC7A5\uC18C \uC624\uB108
 gb.administrator = \uAD00\uB9AC\uC790
 gb.administratorPermission = Gitblit \uAD00\uB9AC\uC790
 gb.team = \uD300
index 75a0ac610b1de487aea951d39f547c5d8a09e217..5471ad8a6cf9c457c1f038b79c4cc6845032dd64 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = repositorie\r
-gb.repoAdministrators = repository beheerders\r
+gb.owner = eigenaar\r
 gb.description = omschrijving\r
 gb.lastChange = laatste wijziging\r
 gb.refs = refs\r
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = toon readme\r
 gb.showReadmeDescription = toon een \"readme\" Markdown bestand in de samenvattingspagina\r
 gb.nameDescription = gebruik '/' voor het groeperen van repositories.  bijv. libraries/mycoollib.git\r
-gb.repoAdministratorsDescription = repository beheerders mag repository instellingen wijzigen\r
+gb.ownerDescription = de eigenaar mag repository instellingen wijzigen\r
 gb.blob = blob\r
 gb.commitActivityTrend = commit activiteit trend\r
 gb.commitActivityDOW = commit activiteit per dag van de week\r
@@ -279,7 +279,7 @@ gb.displayName = display naam
 gb.emailAddress = emailadres\r
 gb.errorAdminLoginRequired = Aanmelden vereist voor beheerwerk\r
 gb.errorOnlyAdminMayCreateRepository = Alleen een beheerder kan een repositorie maken\r
-gb.errorOnlyAdminOrOwnerMayEditRepository = Alleen een beheerder of een repository beheerder kan een repositorie wijzigen\r
+gb.errorOnlyAdminOrOwnerMayEditRepository = Alleen een beheerder of de eigenaar kan een repositorie wijzigen\r
 gb.errorAdministrationDisabled = Beheer is uitgeschakeld\r
 gb.lastNDays = laatste {0} dagen\r
 gb.completeGravatarProfile = Completeer profiel op Gravatar.com\r
@@ -364,7 +364,7 @@ gb.gcPeriod = opruim periode
 gb.gcPeriodDescription = tijdsduur tussen opruimacties\r
 gb.gcThreshold = opruim drempel\r
 gb.gcThresholdDescription = minimum totaalomvang van losse objecten voor het starten van opruimactie\r
-gb.repoAdministratorPermission = repository beheerder\r
+gb.ownerPermission = repositorie eigenaar\r
 gb.administrator = beheer\r
 gb.administratorPermission = Gitblit beheerder\r
 gb.team = team\r
index 4760981ab2ba06ceb957c3031ec52be1630a4696..82ffa635ba8489cd8d9b2b09f9545f4aef248ad2 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = Repozytorium
-gb.repoAdministrators = Administratorzy repozytorium
+gb.owner = W\u0142a\u015Bciciel
 gb.description = Opis
 gb.lastChange = Ostatnia zmiana
 gb.refs = Refs
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = Poka\u017C readme
 gb.showReadmeDescription = Poka\u017C sparsowany \"readme\" na stronie podsumowania
 gb.nameDescription = u\u017Cyj '/' do grupowania repozytori\u00F3w, np. libraries/server-lib.git
-gb.repoAdministratorsDescription = Administrator repozytorium mo\u017Ce edytowa\u0107 ustawienia repozytorium
+gb.ownerDescription = W\u0142a\u015Bciciel mo\u017Ce edytowa\u0107 ustawienia repozytorium
 gb.blob = blob
 gb.commitActivityTrend = Aktywno\u015B\u0107 zmian
 gb.commitActivityDOW = Aktywno\u015B\u0107 zmian wed\u0142ug dnia tygodnia
@@ -279,7 +279,7 @@ gb.displayName = Wy\u015Bwietlana nazwa
 gb.emailAddress = Adres email
 gb.errorAdminLoginRequired = Administracja wymaga zalogowania
 gb.errorOnlyAdminMayCreateRepository = Tylko administrator mo\u017Ce utworzy\u0107 repozytorium
-gb.errorOnlyAdminOrRepoAdminMayEditRepository = Tylko administrator lub administrator repozytorium mo\u017Ce edytowa\u0107 repozytorium.
+gb.errorOnlyAdminOrOwnerMayEditRepository = Tylko administrator lub w\u0142a\u015Bciciel mo\u017Ce edytowa\u0107 repozytorium.
 gb.errorAdministrationDisabled = Administracja jest wy\u0142\u0105czona
 gb.lastNDays = Ostatnich {0} dni
 gb.completeGravatarProfile = Pe\u0142ny profil na Gravatar.com
index 0bbd119ca259d4b7a11d35380a93a5e090af32e6..469d2055c61d8df606a44fc9b01eb75d79bbc602 100644 (file)
@@ -1,5 +1,5 @@
 gb.repository = repositório\r
-gb.repoAdministrators = administradores do repositório\r
+gb.owner = proprietário\r
 gb.description = descrição\r
 gb.lastChange = Ãºltima alteração\r
 gb.refs = refs\r
@@ -94,7 +94,7 @@ gb.zip = zip
 gb.showReadme = mostrar readme\r
 gb.showReadmeDescription = mostrar um arquivo \"leia-me\" na página de resumo\r
 gb.nameDescription = usar '/' para agrupar repositórios.  e.g. libraries/mycoollib.git\r
-gb.repoAdministratorsDescription = o administradores do repositório pode editar configurações do repositório\r
+gb.ownerDescription = o proprietário pode editar configurações do repositório\r
 gb.blob = blob\r
 gb.commitActivityTrend = tendência dos commits\r
 gb.commitActivityDOW = commits diários\r
@@ -279,7 +279,7 @@ gb.displayName = nome
 gb.emailAddress = e-mail\r
 gb.errorAdminLoginRequired = Administração requer um login\r
 gb.errorOnlyAdminMayCreateRepository = Somente umadministrador pode criar um repositório\r
-gb.errorOnlyAdminOrRepoAdminMayEditRepository = Somente umadministrador ou um administrador de repositório pode editar um repositório\r
+gb.errorOnlyAdminOrOwnerMayEditRepository = Somente umadministrador pode editar um repositório\r
 gb.errorAdministrationDisabled = Administração está desabilitada\r
 gb.lastNDays = Ãºltimos {0} dias\r
 gb.completeGravatarProfile = Profile completo em Gravatar.com\r
@@ -364,7 +364,7 @@ gb.gcPeriod = per
 gb.gcPeriodDescription = duração entre as coletas de lixo\r
 gb.gcThreshold = limite do GC \r
 gb.gcThresholdDescription = tamanho total mínimo de objetos \"soltos\" que ativam a coleta de lixo\r
-gb.repoAdministratorPermission = administrador do repositório\r
+gb.ownerPermission = proprietário do repositório\r
 gb.administrator = administrador\r
 gb.administratorPermission = administrador do Gitblit\r
 gb.team = equipe\r
index be9616c0d7805f6b504ae1061dc40af36419c34e..7fc0de230fe36f162a7c2ff4cefbbfb1558ca09e 100644 (file)
@@ -50,7 +50,7 @@
                <div class="tab-pane" id="permissions">\r
                        <table class="plain">\r
                                <tbody class="settings">\r
-                                       <tr><th><wicket:message key="gb.repoAdministrators"></wicket:message></th><td class="edit"><span wicket:id="repoAdministrators" tabindex="15" /> &nbsp;<span class="help-inline"><wicket:message key="gb.repoAdministratorsDescription"></wicket:message></span></td></tr>\r
+                                       <tr><th><wicket:message key="gb.owners"></wicket:message></th><td class="edit"><span wicket:id="owners" tabindex="15" /> </td></tr>\r
                                        <tr><th colspan="2"><hr/></th></tr>\r
                                        <tr><th><wicket:message key="gb.accessRestriction"></wicket:message></th><td class="edit"><select class="span4" wicket:id="accessRestriction" tabindex="16" /></td></tr>\r
                                        <tr><th colspan="2"><hr/></th></tr>\r
index 9a81bde494ed79a0f743a03ee1cd5c46360248a3..d68d6550ad4b67042819d8ed0469e01d01e7e753 100644 (file)
@@ -61,7 +61,6 @@ import com.gitblit.models.RegistrantAccessPermission;
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.ArrayUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.StringChoiceRenderer;\r
@@ -71,8 +70,6 @@ import com.gitblit.wicket.panels.RegistrantPermissionsPanel;
 \r
 public class EditRepositoryPage extends RootSubPage {\r
 \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-       \r
        private final boolean isCreate;\r
 \r
        private boolean isAdmin;\r
@@ -97,7 +94,7 @@ public class EditRepositoryPage extends RootSubPage {
                        // personal create permissions, inject personal repository path\r
                        model.name = user.getPersonalPath() + "/";\r
                        model.projectPath = user.getPersonalPath();\r
-                       model.addRepoAdministrator(user.username);\r
+                       model.addOwner(user.username);\r
                        // personal repositories are private by default\r
                        model.accessRestriction = AccessRestrictionType.VIEW;\r
                        model.authorizationControl = AuthorizationControl.NAMED;\r
@@ -167,11 +164,11 @@ public class EditRepositoryPage extends RootSubPage {
                final RegistrantPermissionsPanel teamsPalette = new RegistrantPermissionsPanel("teams", \r
                                RegistrantType.TEAM, GitBlit.self().getAllTeamnames(), repositoryTeams, getAccessPermissions());\r
 \r
-               // repo administrators palette\r
-               List admins = multiConfigUtil.convertCollectionToList(repositoryModel.getRepoAdministrators());\r
-               List persons = GitBlit.self().getAllUsernames();\r
-               final Palette repoAdministratorsPalette = new Palette("repoAdministrators", new ListModel<String>(admins), new CollectionModel<String>(\r
-                     persons), new StringChoiceRenderer(), 10, true);\r
+               // owners palette\r
+               List<String> owners = new ArrayList<String>(repositoryModel.owners);\r
+               List<String> persons = GitBlit.self().getAllUsernames();\r
+               final Palette<String> ownersPalette = new Palette<String>("owners", new ListModel<String>(owners), new CollectionModel<String>(\r
+                     persons), new StringChoiceRenderer(), 12, true);\r
                \r
                // indexed local branches palette\r
                List<String> allLocalBranches = new ArrayList<String>();\r
@@ -335,10 +332,11 @@ public class EditRepositoryPage extends RootSubPage {
                                        }\r
                                        repositoryModel.indexedBranches = indexedBranches;\r
 \r
-                                       repositoryModel.removeAllRepoAdministrators();\r
-                                       Iterator<String> repoAdmins = repoAdministratorsPalette.getSelectedChoices();\r
-                                       while (repoAdmins.hasNext()) {\r
-                                               repositoryModel.addRepoAdministrator(repoAdmins.next());\r
+                                       // owners\r
+                                       repositoryModel.owners.clear();\r
+                                       Iterator<String> owners = ownersPalette.getSelectedChoices();\r
+                                       while (owners.hasNext()) {\r
+                                               repositoryModel.addOwner(owners.next());\r
                                        }\r
                                        \r
                                        // pre-receive scripts\r
@@ -392,7 +390,7 @@ public class EditRepositoryPage extends RootSubPage {
                // field names reflective match RepositoryModel fields\r
                form.add(new TextField<String>("name").setEnabled(allowEditName));\r
                form.add(new TextField<String>("description"));\r
-               form.add(repoAdministratorsPalette);\r
+               form.add(ownersPalette);\r
                form.add(new CheckBox("allowForks").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));\r
                DropDownChoice<AccessRestrictionType> accessRestriction = new DropDownChoice<AccessRestrictionType>("accessRestriction", Arrays\r
                                .asList(AccessRestrictionType.values()), new AccessRestrictionRenderer());\r
@@ -573,9 +571,9 @@ public class EditRepositoryPage extends RootSubPage {
                                                isAdmin = true;\r
                                                return;\r
                                        } else {\r
-                                               if (!model.isRepoAdministrator(user.username)) {\r
-                                                       // User is not an Admin nor RepoAdministrator\r
-                                                       error(getString("gb.errorOnlyAdminOrRepoAdminMayEditRepository"), true);\r
+                                               if (!model.isOwner(user.username)) {\r
+                                                       // User is not an Admin nor Owner\r
+                                                       error(getString("gb.errorOnlyAdminOrOwnerMayEditRepository"), true);\r
                                                }\r
                                        }\r
                                }\r
index b67aaa6da876886c4a1de8c7e9cd9283fb7145d0..094144b4ca230d5ec006f2638274c8c93b5df04c 100644 (file)
@@ -79,7 +79,7 @@ public abstract class RepositoryPage extends BasePage {
        \r
        private final Map<String, PageRegistration> registeredPages;\r
        private boolean showAdmin;\r
-       private boolean isRepoAdministrator;\r
+       private boolean isOwner;\r
        \r
        public RepositoryPage(PageParameters params) {\r
                super(params);\r
@@ -183,10 +183,10 @@ public abstract class RepositoryPage extends BasePage {
                } else {\r
                        showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);\r
                }\r
-               isRepoAdministrator = GitBlitWebSession.get().isLoggedIn()\r
-                               && (model.isRepoAdministrator(GitBlitWebSession.get()\r
+               isOwner = GitBlitWebSession.get().isLoggedIn()\r
+                               && (model.isOwner(GitBlitWebSession.get()\r
                                                .getUsername()));\r
-               if (showAdmin || isRepoAdministrator) {\r
+               if (showAdmin || isOwner) {\r
                        pages.put("edit", new PageRegistration("gb.edit", EditRepositoryPage.class, params));\r
                }\r
                return pages;\r
@@ -540,7 +540,7 @@ public abstract class RepositoryPage extends BasePage {
        }\r
        \r
        public boolean isOwner() {\r
-               return isRepoAdministrator;\r
+               return isOwner;\r
        }\r
        \r
        private class SearchForm extends SessionlessForm<Void> implements Serializable {\r
index ed1bdfbf070852a84afc41123a4e2de639e37d27..e7e12ccc67102e7062aec635c69ac0731c1b1c79 100644 (file)
@@ -88,7 +88,7 @@ public abstract class RootSubPage extends RootPage {
                        if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)\r
                                        && repositoryModel.authorizationControl.equals(AuthorizationControl.NAMED)) {\r
                                if (user != null &&\r
-                                               (repositoryModel.isRepoAdministrator(user.username) || repositoryModel.isUsersPersonalRepository(user.username))) {\r
+                                               (repositoryModel.isOwner(user.username) || repositoryModel.isUsersPersonalRepository(user.username))) {\r
                                        // exclude Owner or personal repositories\r
                                        continue;\r
                                }\r
index 788dbb574f7c2b4c35993869def2c9d5f26ce595..3e85df99e611056b6df05ce5186db6769ea72dae 100644 (file)
@@ -16,7 +16,7 @@
                <div class="hidden-phone" style="padding-bottom: 10px;"> \r
                        <table class="plain">\r
                                <tr><th><wicket:message key="gb.description">[description]</wicket:message></th><td><span wicket:id="repositoryDescription">[repository description]</span></td></tr>\r
-                               <tr><th><wicket:message key="gb.repoAdministrators">[owner]</wicket:message></th><td><span wicket:id="repositoryAdministrators">[repository owner]</span></td></tr>\r
+                               <tr><th><wicket:message key="gb.owners">[owner]</wicket:message></th><td><span wicket:id="repositoryOwners"><span wicket:id="owner"></span><span wicket:id="comma"></span></span></td></tr>\r
                                <tr><th><wicket:message key="gb.lastChange">[last change]</wicket:message></th><td><span wicket:id="repositoryLastChange">[repository last change]</span></td></tr>\r
                                <tr><th><wicket:message key="gb.stats">[stats]</wicket:message></th><td><span wicket:id="branchStats">[branch stats]</span> <span class="link"><a wicket:id="metrics"><wicket:message key="gb.metrics">[metrics]</wicket:message></a></span></td></tr>\r
                                <tr><th style="vertical-align:top;"><wicket:message key="gb.repositoryUrl">[URL]</wicket:message>&nbsp;<img style="vertical-align: top;padding-left:3px;" wicket:id="accessRestrictionIcon" /></th><td><span wicket:id="repositoryCloneUrl">[repository clone url]</span><div wicket:id="otherUrls"></div></td></tr>\r
                <div style="border:1px solid #ddd;border-radius: 0 0 3px 3px;padding: 20px;">\r
                        <div wicket:id="readmeContent" class="markdown"></div>\r
                </div>\r
-       </wicket:fragment>      \r
+       </wicket:fragment>\r
+       \r
+       <wicket:fragment wicket:id="ownersFragment">\r
+               \r
+       </wicket:fragment>\r
 </wicket:extend>       \r
 </body>\r
 </html>
\ No newline at end of file
index 3b2c92a1fc5b900e8c791181aa9fcc52a94e94f4..bd40a1b7c2742c4b2443221faf747d35ef586c0e 100644 (file)
@@ -27,6 +27,9 @@ import org.apache.wicket.PageParameters;
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
 import org.apache.wicket.markup.html.panel.Fragment;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
 import org.wicketstuff.googlecharts.Chart;\r
@@ -49,7 +52,6 @@ import com.gitblit.models.UserModel;
 import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.MarkdownUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.WicketUtils;\r
 import com.gitblit.wicket.panels.BranchesPanel;\r
@@ -60,8 +62,6 @@ import com.gitblit.wicket.panels.TagsPanel;
 \r
 public class SummaryPage extends RepositoryPage {\r
 \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-       \r
        public SummaryPage(PageParameters params) {\r
                super(params);\r
 \r
@@ -85,14 +85,29 @@ public class SummaryPage extends RepositoryPage {
 \r
                // repository description\r
                add(new Label("repositoryDescription", getRepositoryModel().description));\r
-               String repoAdministrators = multiConfigUtil.convertCollectionToSingleLineString(getRepositoryModel().getRepoAdministrators());\r
-               if (StringUtils.isEmpty(repoAdministrators)) {\r
-                       add(new Label("repositoryAdministrators").setVisible(false));\r
-               } else {                        \r
-                       //TODO reimplement link panel for each username\r
-                       add(new Label("repositoryAdministrators", repoAdministrators));                 \r
-               }\r
-\r
+               \r
+               // owner links\r
+               final List<String> owners = new ArrayList<String>(getRepositoryModel().owners);\r
+               ListDataProvider<String> ownersDp = new ListDataProvider<String>(owners);\r
+               DataView<String> ownersView = new DataView<String>("repositoryOwners", ownersDp) {\r
+                       private static final long serialVersionUID = 1L;\r
+                       int counter = 0;\r
+                       public void populateItem(final Item<String> item) {\r
+                               UserModel ownerModel = GitBlit.self().getUserModel(item.getModelObject());\r
+                               if (ownerModel != null) {\r
+                                       item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,\r
+                                                       WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));\r
+                               } else {\r
+                                       item.add(new Label("owner").setVisible(false));\r
+                               }\r
+                               counter++;\r
+                               item.add(new Label("comma", ",").setVisible(counter < owners.size()));\r
+                               item.setRenderBodyOnly(true);\r
+                       }\r
+               };\r
+               ownersView.setRenderBodyOnly(true);\r
+               add(ownersView);\r
+               \r
                add(WicketUtils.createTimestampLabel("repositoryLastChange",\r
                                JGitUtils.getLastChange(r), getTimeZone(), getTimeUtils()));\r
                if (metricsTotal == null) {\r
index e953235cf718c6a5400bf93e1e50dbfd554befaa..46781536ffb10efce08ca4e842391266b5980d51 100644 (file)
@@ -51,7 +51,7 @@
                                                <img style="border:0px;vertical-align:middle;" src="feed_16x16.png"></img>\r
                                        </a>\r
                                </div>\r
-                               <span style="color: #999;font-style:italic;font-size:0.8em;" wicket:id="repositoryAdministrators">[owner]</span>\r
+                               <span style="color: #999;font-style:italic;font-size:0.8em;" wicket:id="repositoryOwner">[owner]</span>\r
                        </div>  \r
                        \r
                        <div class="pageTitle" style="border:0px;">\r
index d4f2a3a8b8aee7e18cc291dc8c7a92bce7ccadc0..0bc7add00d59f8256eab7e08cf7f05a9d77f4950 100644 (file)
@@ -36,7 +36,6 @@ import com.gitblit.SyndicationServlet;
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.ArrayUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.WicketUtils;\r
@@ -52,104 +51,94 @@ public class ProjectRepositoryPanel extends BasePanel {
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-\r
-       public ProjectRepositoryPanel(String wicketId, Localizer localizer,\r
-                       Component parent, final boolean isAdmin,\r
-                       final RepositoryModel entry,\r
+       public ProjectRepositoryPanel(String wicketId, Localizer localizer, Component parent,\r
+                       final boolean isAdmin, final RepositoryModel entry,\r
                        final Map<AccessRestrictionType, String> accessRestrictions) {\r
                super(wicketId);\r
 \r
-               final boolean showSwatch = GitBlit.getBoolean(\r
-                               Keys.web.repositoryListSwatches, true);\r
-               final boolean gitServlet = GitBlit.getBoolean(\r
-                               Keys.git.enableGitServlet, true);\r
-               final boolean showSize = GitBlit.getBoolean(\r
-                               Keys.web.showRepositorySizes, true);\r
+               final boolean showSwatch = GitBlit.getBoolean(Keys.web.repositoryListSwatches, true);\r
+               final boolean gitServlet = GitBlit.getBoolean(Keys.git.enableGitServlet, true);\r
+               final boolean showSize = GitBlit.getBoolean(Keys.web.showRepositorySizes, true);\r
 \r
                // repository swatch\r
                Component swatch;\r
                if (entry.isBare) {\r
-                       swatch = new Label("repositorySwatch", "&nbsp;")\r
-                                       .setEscapeModelStrings(false);\r
+                       swatch = new Label("repositorySwatch", "&nbsp;").setEscapeModelStrings(false);\r
                } else {\r
                        swatch = new Label("repositorySwatch", "!");\r
-                       WicketUtils.setHtmlTooltip(swatch,\r
-                                       localizer.getString("gb.workingCopyWarning", parent));\r
+                       WicketUtils.setHtmlTooltip(swatch, localizer.getString("gb.workingCopyWarning", parent));\r
                }\r
                WicketUtils.setCssBackground(swatch, entry.toString());\r
                add(swatch);\r
                swatch.setVisible(showSwatch);\r
 \r
                PageParameters pp = WicketUtils.newRepositoryParameter(entry.name);\r
-               add(new LinkPanel("repositoryName", "list",\r
-                               StringUtils.getRelativePath(entry.projectPath,\r
-                                               StringUtils.stripDotGit(entry.name)),\r
-                               SummaryPage.class, pp));\r
-               add(new Label("repositoryDescription", entry.description)\r
-                               .setVisible(!StringUtils.isEmpty(entry.description)));\r
+               add(new LinkPanel("repositoryName", "list", StringUtils.getRelativePath(entry.projectPath,\r
+                               StringUtils.stripDotGit(entry.name)), SummaryPage.class, pp));\r
+               add(new Label("repositoryDescription", entry.description).setVisible(!StringUtils\r
+                               .isEmpty(entry.description)));\r
 \r
                if (StringUtils.isEmpty(entry.originRepository)) {\r
                        add(new Label("originRepository").setVisible(false));\r
                } else {\r
-                       Fragment forkFrag = new Fragment("originRepository",\r
-                                       "originFragment", this);\r
-                       forkFrag.add(new LinkPanel("originRepository", null, StringUtils\r
-                                       .stripDotGit(entry.originRepository), SummaryPage.class,\r
-                                       WicketUtils.newRepositoryParameter(entry.originRepository)));\r
+                       Fragment forkFrag = new Fragment("originRepository", "originFragment", this);\r
+                       forkFrag.add(new LinkPanel("originRepository", null, StringUtils.stripDotGit(entry.originRepository), \r
+                                       SummaryPage.class, WicketUtils.newRepositoryParameter(entry.originRepository)));\r
                        add(forkFrag);\r
                }\r
 \r
-               add(new BookmarkablePageLink<Void>("tickets", TicketsPage.class, pp)\r
-                               .setVisible(entry.useTickets));\r
-               add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp)\r
-                               .setVisible(entry.useDocs));\r
+               add(new BookmarkablePageLink<Void>("tickets", TicketsPage.class, pp).setVisible(entry.useTickets));\r
+               add(new BookmarkablePageLink<Void>("docs", DocsPage.class, pp).setVisible(entry.useDocs));\r
 \r
                if (entry.isFrozen) {\r
-                       add(WicketUtils.newImage("frozenIcon", "cold_16x16.png",\r
-                                       localizer.getString("gb.isFrozen", parent)));\r
+                       add(WicketUtils.newImage("frozenIcon", "cold_16x16.png", localizer.getString("gb.isFrozen", parent)));\r
                } else {\r
                        add(WicketUtils.newClearPixel("frozenIcon").setVisible(false));\r
                }\r
 \r
                if (entry.isFederated) {\r
-                       add(WicketUtils.newImage("federatedIcon", "federated_16x16.png",\r
-                                       localizer.getString("gb.isFederated", parent)));\r
+                       add(WicketUtils.newImage("federatedIcon", "federated_16x16.png", localizer.getString("gb.isFederated", parent)));\r
                } else {\r
                        add(WicketUtils.newClearPixel("federatedIcon").setVisible(false));\r
                }\r
                switch (entry.accessRestriction) {\r
                case NONE:\r
-                       add(WicketUtils.newBlankImage("accessRestrictionIcon").setVisible(\r
-                                       false));\r
+                       add(WicketUtils.newBlankImage("accessRestrictionIcon").setVisible(false));\r
                        break;\r
                case PUSH:\r
-                       add(WicketUtils.newImage("accessRestrictionIcon",\r
-                                       "lock_go_16x16.png",\r
+                       add(WicketUtils.newImage("accessRestrictionIcon", "lock_go_16x16.png",\r
                                        accessRestrictions.get(entry.accessRestriction)));\r
                        break;\r
                case CLONE:\r
-                       add(WicketUtils.newImage("accessRestrictionIcon",\r
-                                       "lock_pull_16x16.png",\r
+                       add(WicketUtils.newImage("accessRestrictionIcon", "lock_pull_16x16.png",\r
                                        accessRestrictions.get(entry.accessRestriction)));\r
                        break;\r
                case VIEW:\r
-                       add(WicketUtils.newImage("accessRestrictionIcon",\r
-                                       "shield_16x16.png",\r
+                       add(WicketUtils.newImage("accessRestrictionIcon", "shield_16x16.png",\r
                                        accessRestrictions.get(entry.accessRestriction)));\r
                        break;\r
                default:\r
                        add(WicketUtils.newBlankImage("accessRestrictionIcon"));\r
                }\r
 \r
-               if (entry.getRepoAdministrators().size() < 1) {\r
-                       add(new Label("repositoryAdministrators").setVisible(false));\r
+               if (ArrayUtils.isEmpty(entry.owners)) {\r
+                       add(new Label("repositoryOwner").setVisible(false));\r
                } else {\r
-                       add(new Label("repositoryAdministrators",\r
-                                       multiConfigUtil.convertCollectionToSingleLineString(entry\r
-                                                       .getRepoAdministrators())\r
-                                                       + " ("\r
-                                                       + localizer.getString("gb.repoAdministrators", parent) + ")"));\r
+                       String owner = "";\r
+                       for (String username : entry.owners) {\r
+                               UserModel ownerModel = GitBlit.self().getUserModel(username);\r
+                       \r
+                               if (ownerModel != null) {\r
+                                       owner = ownerModel.getDisplayName();\r
+                               }                               \r
+                       }\r
+                       if (entry.owners.size() > 1) {\r
+                               owner += ", ...";\r
+                       }\r
+                       Label ownerLabel = (new Label("repositoryOwner", owner + " (" +\r
+                                       localizer.getString("gb.owner", parent) + ")"));\r
+                       WicketUtils.setHtmlTooltip(ownerLabel, ArrayUtils.toString(entry.owners));\r
+                       add(ownerLabel);\r
                }\r
 \r
                UserModel user = GitBlitWebSession.get().getUser();\r
@@ -157,19 +146,15 @@ public class ProjectRepositoryPanel extends BasePanel {
                        user = UserModel.ANONYMOUS;\r
                }\r
                Fragment repositoryLinks;\r
-               boolean isRepoAdministrator = entry.isRepoAdministrator(user.username);\r
+               boolean showOwner = entry.isOwner(user.username);\r
                // owner of personal repository gets admin powers\r
-               boolean showAdmin = isAdmin\r
-                               || entry.isUsersPersonalRepository(user.username);\r
-\r
-               if (showAdmin || isRepoAdministrator) {\r
-                       repositoryLinks = new Fragment(\r
-                                       "repositoryLinks",\r
-                                       showAdmin ? "repositoryAdminLinks" : "repositoryOwnerLinks",\r
-                                       this);\r
-                       repositoryLinks.add(new BookmarkablePageLink<Void>(\r
-                                       "editRepository", EditRepositoryPage.class, WicketUtils\r
-                                                       .newRepositoryParameter(entry.name)));\r
+               boolean showAdmin = isAdmin || entry.isUsersPersonalRepository(user.username);\r
+\r
+               if (showAdmin || showOwner) {\r
+                       repositoryLinks = new Fragment("repositoryLinks", showAdmin ? "repositoryAdminLinks"\r
+                                       : "repositoryOwnerLinks", this);\r
+                       repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository", EditRepositoryPage.class,\r
+                                       WicketUtils.newRepositoryParameter(entry.name)));\r
                        if (showAdmin) {\r
                                Link<Void> deleteLink = new Link<Void>("deleteRepository") {\r
 \r
@@ -180,41 +165,28 @@ public class ProjectRepositoryPanel extends BasePanel {
                                                if (GitBlit.self().deleteRepositoryModel(entry)) {\r
                                                        // redirect to the owning page\r
                                                        if (entry.isPersonalRepository()) {\r
-                                                               setResponsePage(\r
-                                                                               getPage().getClass(),\r
-                                                                               WicketUtils\r
-                                                                                               .newUsernameParameter(entry.projectPath\r
-                                                                                                               .substring(1)));\r
+                                                               setResponsePage(getPage().getClass(), WicketUtils.newUsernameParameter(entry.projectPath.substring(1)));\r
                                                        } else {\r
-                                                               setResponsePage(\r
-                                                                               getPage().getClass(),\r
-                                                                               WicketUtils\r
-                                                                                               .newProjectParameter(entry.projectPath));\r
+                                                               setResponsePage(getPage().getClass(), WicketUtils.newProjectParameter(entry.projectPath));\r
                                                        }\r
                                                } else {\r
-                                                       error(MessageFormat.format(\r
-                                                                       getString("gb.repositoryDeleteFailed"),\r
-                                                                       entry));\r
+                                                       error(MessageFormat.format(getString("gb.repositoryDeleteFailed"), entry));\r
                                                }\r
                                        }\r
                                };\r
-                               deleteLink.add(new JavascriptEventConfirmation("onclick",\r
-                                               MessageFormat.format(localizer.getString(\r
-                                                               "gb.deleteRepository", parent), entry)));\r
+                               deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(\r
+                                               localizer.getString("gb.deleteRepository", parent), entry)));\r
                                repositoryLinks.add(deleteLink);\r
                        }\r
                } else {\r
-                       repositoryLinks = new Fragment("repositoryLinks",\r
-                                       "repositoryUserLinks", this);\r
+                       repositoryLinks = new Fragment("repositoryLinks", "repositoryUserLinks", this);\r
                }\r
 \r
-               repositoryLinks.add(new BookmarkablePageLink<Void>("tree",\r
-                               TreePage.class, WicketUtils.newRepositoryParameter(entry.name))\r
-                               .setEnabled(entry.hasCommits));\r
+               repositoryLinks.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils\r
+                               .newRepositoryParameter(entry.name)).setEnabled(entry.hasCommits));\r
 \r
-               repositoryLinks.add(new BookmarkablePageLink<Void>("log",\r
-                               LogPage.class, WicketUtils.newRepositoryParameter(entry.name))\r
-                               .setEnabled(entry.hasCommits));\r
+               repositoryLinks.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils\r
+                               .newRepositoryParameter(entry.name)).setEnabled(entry.hasCommits));\r
 \r
                add(repositoryLinks);\r
 \r
@@ -226,20 +198,17 @@ public class ProjectRepositoryPanel extends BasePanel {
                }\r
                Label lastChangeLabel = new Label("repositoryLastChange", lastChange);\r
                add(lastChangeLabel);\r
-               WicketUtils.setCssClass(lastChangeLabel,\r
-                               getTimeUtils().timeAgoCss(entry.lastChange));\r
+               WicketUtils.setCssClass(lastChangeLabel, getTimeUtils().timeAgoCss(entry.lastChange));\r
 \r
                if (entry.hasCommits) {\r
                        // Existing repository\r
                        add(new Label("repositorySize", entry.size).setVisible(showSize));\r
                } else {\r
                        // New repository\r
-                       add(new Label("repositorySize", localizer.getString("gb.empty",\r
-                                       parent)).setEscapeModelStrings(false));\r
+                       add(new Label("repositorySize", localizer.getString("gb.empty", parent)).setEscapeModelStrings(false));\r
                }\r
 \r
-               add(new ExternalLink("syndication", SyndicationServlet.asLink("",\r
-                               entry.name, null, 0)));\r
+               add(new ExternalLink("syndication", SyndicationServlet.asLink("", entry.name, null, 0)));\r
 \r
                List<String> repositoryUrls = new ArrayList<String>();\r
                if (gitServlet) {\r
@@ -248,8 +217,7 @@ public class ProjectRepositoryPanel extends BasePanel {
                }\r
                repositoryUrls.addAll(GitBlit.self().getOtherCloneUrls(entry.name));\r
 \r
-               String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? ""\r
-                               : repositoryUrls.remove(0);\r
+               String primaryUrl = ArrayUtils.isEmpty(repositoryUrls) ? "" : repositoryUrls.remove(0);\r
                add(new RepositoryUrlPanel("repositoryCloneUrl", primaryUrl));\r
        }\r
 }\r
index b3efdd8060a1ca737caea75e593637e5b9689075..4156cd190bad11c8a7599fcefa8669039e6d4ad6 100644 (file)
@@ -162,8 +162,8 @@ public class RegistrantPermissionsPanel extends BasePanel {
                                        item.add(administrator);
                                        break;
                                case OWNER:
-                                       Label owner = new Label("pType", getString("gb.repoAdministrators"));
-                                       WicketUtils.setHtmlTooltip(owner, getString("gb.repoAdministratorPermission"));
+                                       Label owner = new Label("pType", getString("gb.owner"));
+                                       WicketUtils.setHtmlTooltip(owner, getString("gb.ownerPermission"));
                                        WicketUtils.setCssClass(owner, "label label-info");
                                        item.add(owner);
                                        break;
index 98ff4308f0baa855df75f25b8fe2316263271d7b..42f9f1f2a399be68eff1003a756f76b16d507ccd 100644 (file)
@@ -57,7 +57,7 @@
                                <wicket:message key="gb.repository">Repository</wicket:message>\r
                        </th>\r
                        <th class="hidden-phone" wicket:id="orderByDescription"><wicket:message key="gb.description">Description</wicket:message></th>\r
-                       <th class="hidden-tablet hidden-phone" wicket:id="orderByOwner"><wicket:message key="gb.repoAdministrators">Owner</wicket:message></th>\r
+                       <th class="hidden-tablet hidden-phone" wicket:id="orderByOwner"><wicket:message key="gb.owner">Owner</wicket:message></th>\r
                        <th class="hidden-phone"></th>\r
                        <th wicket:id="orderByDate"><wicket:message key="gb.lastChange">Last Change</wicket:message></th>\r
                        <th class="hidden-phone"></th>\r
@@ -72,7 +72,7 @@
                                <wicket:message key="gb.repository">Repository</wicket:message>\r
                        </th>\r
                        <th class="hidden-phone" ><span><wicket:message key="gb.description">Description</wicket:message></span></th>\r
-                       <th class="hidden-tablet hidden-phone"><span><wicket:message key="gb.repoAdministrators">Owner</wicket:message></span></th>\r
+                       <th class="hidden-tablet hidden-phone"><span><wicket:message key="gb.owner">Owner</wicket:message></span></th>\r
                        <th class="hidden-phone"></th>\r
                        <th><wicket:message key="gb.lastChange">Last Change</wicket:message></th>\r
                        <th class="hidden-phone"></th>\r
@@ -88,7 +88,7 @@
        <wicket:fragment wicket:id="repositoryRow">\r
         <td class="left" style="padding-left:3px;" ><b><span class="repositorySwatch" wicket:id="repositorySwatch"></span></b> <span style="padding-left:3px;" wicket:id="repositoryName">[repository name]</span></td>\r
         <td class="hidden-phone"><span class="list" wicket:id="repositoryDescription">[repository description]</span></td>\r
-        <td class="hidden-tablet hidden-phone author"><span wicket:id="repositoryAdministrators">[repository owner]</span></td>\r
+        <td class="hidden-tablet hidden-phone author"><span wicket:id="repositoryOwner">[repository owner]</span></td>\r
         <td class="hidden-phone" style="text-align: right;padding-right:10px;"><img class="inlineIcon" wicket:id="forkIcon" /><img class="inlineIcon" wicket:id="ticketsIcon" /><img class="inlineIcon" wicket:id="docsIcon" /><img class="inlineIcon" wicket:id="frozenIcon" /><img class="inlineIcon" wicket:id="federatedIcon" /><img class="inlineIcon" wicket:id="accessRestrictionIcon" /></td>\r
         <td><span wicket:id="repositoryLastChange">[last change]</span></td>\r
         <td class="hidden-phone" style="text-align: right;padding-right:15px;"><span style="font-size:0.8em;" wicket:id="repositorySize">[repository size]</span></td>\r
index c6c57a7928f9649e2be4e240b323b74dfab7d9b3..f4fcaacbc0768883fdc8ade990ad95ac0e03a049 100644 (file)
@@ -49,7 +49,7 @@ import com.gitblit.SyndicationServlet;
 import com.gitblit.models.ProjectModel;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
-import com.gitblit.utils.MultiConfigUtil;\r
+import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.wicket.GitBlitWebSession;\r
 import com.gitblit.wicket.WicketUtils;\r
@@ -65,8 +65,6 @@ public class RepositoriesPanel extends BasePanel {
 \r
        private static final long serialVersionUID = 1L;\r
 \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-       \r
        public RepositoriesPanel(String wicketId, final boolean showAdmin, final boolean showManagement,\r
                        List<RepositoryModel> models, boolean enableLinks,\r
                        final Map<AccessRestrictionType, String> accessRestrictionTranslations) {\r
@@ -290,7 +288,23 @@ public class RepositoriesPanel extends BasePanel {
                                        row.add(WicketUtils.newBlankImage("accessRestrictionIcon"));\r
                                }\r
 \r
-                               row.add(new Label("repositoryAdministrators", multiConfigUtil.convertCollectionToSingleLineString(entry.getRepoAdministrators())));\r
+                               String owner = "";\r
+                               if (!ArrayUtils.isEmpty(entry.owners)) {\r
+                                       // display first owner\r
+                                       for (String username : entry.owners) {\r
+                                               UserModel ownerModel = GitBlit.self().getUserModel(username);\r
+                                               if (ownerModel != null) {\r
+                                                       owner = ownerModel.getDisplayName();\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                                       if (entry.owners.size() > 1) {\r
+                                               owner += ", ...";\r
+                                       }\r
+                               }\r
+                               Label ownerLabel = new Label("repositoryOwner", owner);\r
+                               WicketUtils.setHtmlTooltip(ownerLabel, ArrayUtils.toString(entry.owners));\r
+                               row.add(ownerLabel);\r
 \r
                                String lastChange;\r
                                if (entry.lastChange.getTime() == 0) {\r
@@ -302,29 +316,42 @@ public class RepositoriesPanel extends BasePanel {
                                row.add(lastChangeLabel);\r
                                WicketUtils.setCssClass(lastChangeLabel, getTimeUtils().timeAgoCss(entry.lastChange));\r
 \r
-                               boolean isRepoAdministrator = user != null && entry.isRepoAdministrator(user.username);\r
-                               boolean myPersonalRepository = isRepoAdministrator && entry.isUsersPersonalRepository(user.username);\r
+                               boolean showOwner = user != null && entry.isOwner(user.username);\r
+                               boolean myPersonalRepository = showOwner && entry.isUsersPersonalRepository(user.username);\r
                                if (showAdmin || myPersonalRepository) {\r
                                        Fragment repositoryLinks = new Fragment("repositoryLinks",\r
                                                        "repositoryAdminLinks", this);\r
                                        repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository",\r
                                                        EditRepositoryPage.class, WicketUtils\r
                                                                        .newRepositoryParameter(entry.name)));\r
-                                       Link<Void> deleteLink = new DeleteLink(entry, dp);\r
+                                       Link<Void> deleteLink = new Link<Void>("deleteRepository") {\r
+\r
+                                               private static final long serialVersionUID = 1L;\r
+\r
+                                               @Override\r
+                                               public void onClick() {\r
+                                                       if (GitBlit.self().deleteRepositoryModel(entry)) {\r
+                                                               if (dp instanceof SortableRepositoriesProvider) {\r
+                                                                       info(MessageFormat.format(getString("gb.repositoryDeleted"), entry));\r
+                                                                       ((SortableRepositoriesProvider) dp).remove(entry);\r
+                                                               } else {\r
+                                                                       setResponsePage(getPage().getClass(), getPage().getPageParameters());\r
+                                                               }\r
+                                                       } else {\r
+                                                               error(MessageFormat.format(getString("gb.repositoryDeleteFailed"), entry));\r
+                                                       }\r
+                                               }\r
+                                       };\r
                                        deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(\r
                                                        getString("gb.deleteRepository"), entry)));\r
                                        repositoryLinks.add(deleteLink);\r
                                        row.add(repositoryLinks);\r
-                               } else if (isRepoAdministrator) {\r
+                               } else if (showOwner) {\r
                                        Fragment repositoryLinks = new Fragment("repositoryLinks",\r
-                                                       "repositoryAdminLinks", this);\r
+                                                       "repositoryOwnerLinks", this);\r
                                        repositoryLinks.add(new BookmarkablePageLink<Void>("editRepository",\r
                                                        EditRepositoryPage.class, WicketUtils\r
                                                                        .newRepositoryParameter(entry.name)));\r
-                                       Link<Void> deleteLink = new DeleteLink(entry, dp);\r
-                                       deleteLink.add(new JavascriptEventConfirmation("onclick", MessageFormat.format(\r
-                                                       getString("gb.deleteRepository"), entry)));\r
-                                       repositoryLinks.add(deleteLink);\r
                                        row.add(repositoryLinks);\r
                                } else {\r
                                        row.add(new Label("repositoryLinks"));\r
@@ -353,35 +380,6 @@ public class RepositoriesPanel extends BasePanel {
                }\r
        }\r
 \r
-       private class DeleteLink extends Link<Void> {\r
-                       private RepositoryModel entry;\r
-\r
-                       private IDataProvider<RepositoryModel> dp;\r
-                       \r
-                       private static final long serialVersionUID = 1L;\r
-\r
-                       public DeleteLink(RepositoryModel entry, IDataProvider<RepositoryModel> dp) {\r
-                               super("deleteRepository");\r
-                               this.entry=entry;\r
-                               this.dp=dp;\r
-                       }\r
-                       \r
-                       @Override\r
-                       public void onClick() {\r
-                               if (GitBlit.self().deleteRepositoryModel(entry)) {\r
-                                       if (dp instanceof SortableRepositoriesProvider) {\r
-                                               info(MessageFormat.format(getString("gb.repositoryDeleted"), entry));\r
-                                               ((SortableRepositoriesProvider) dp).remove(entry);\r
-                                       } else {\r
-                                               setResponsePage(getPage().getClass(), getPage().getPageParameters());\r
-                                       }\r
-                               } else {\r
-                                       error(MessageFormat.format(getString("gb.repositoryDeleteFailed"), entry));\r
-                               }\r
-                       }\r
-               \r
-       }\r
-       \r
        private static class GroupRepositoryModel extends RepositoryModel {\r
 \r
                private static final long serialVersionUID = 1L;\r
@@ -475,8 +473,6 @@ public class RepositoriesPanel extends BasePanel {
 \r
                private List<RepositoryModel> list;\r
 \r
-               private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
-               \r
                protected SortableRepositoriesProvider(List<RepositoryModel> list) {\r
                        this.list = list;\r
                        setSort(SortBy.date.name(), false);\r
@@ -529,10 +525,12 @@ public class RepositoriesPanel extends BasePanel {
                                Collections.sort(list, new Comparator<RepositoryModel>() {\r
                                        @Override\r
                                        public int compare(RepositoryModel o1, RepositoryModel o2) {\r
+                                               String own1 = ArrayUtils.toString(o1.owners);\r
+                                               String own2 = ArrayUtils.toString(o2.owners);\r
                                                if (asc) {\r
-                                                       return multiConfigUtil.convertCollectionToSingleLineString(o1.getRepoAdministrators()).compareTo(multiConfigUtil.convertCollectionToSingleLineString(o2.getRepoAdministrators()));\r
+                                                       return own1.compareTo(own2);\r
                                                }\r
-                                               return multiConfigUtil.convertCollectionToSingleLineString(o2.getRepoAdministrators()).compareTo(multiConfigUtil.convertCollectionToSingleLineString(o1.getRepoAdministrators()));\r
+                                               return own2.compareTo(own1);\r
                                        }\r
                                });\r
                        } else if (prop.equals(SortBy.description.name())) {\r
index be9960a98641a3cf2432cee70d6214bd6b4518f5..ced500a5636ed78962840d0f98aa3bfe153c8b69 100644 (file)
@@ -72,7 +72,7 @@ public class FederationTests {
                        model.accessRestriction = AccessRestrictionType.VIEW;\r
                        model.description = "cloneable repository " + i;\r
                        model.lastChange = new Date();\r
-                       model.addRepoAdministrator("adminuser");\r
+                       model.addOwner("adminuser");\r
                        model.name = "repo" + i + ".git";\r
                        model.size = "5 MB";\r
                        model.hasCommits = true;\r
index 284be4c5e15fdc5b4b22e064e9e51f06f13f270f..a05b3650bcf2a976cc523772890df1fd0c33bb0e 100644 (file)
@@ -40,8 +40,8 @@ import com.gitblit.Keys;
 import com.gitblit.models.PushLogEntry;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
+import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.JGitUtils;\r
-import com.gitblit.utils.MultiConfigUtil;\r
 import com.gitblit.utils.PushLogUtils;\r
 \r
 public class GitServletTest {\r
@@ -59,8 +59,6 @@ public class GitServletTest {
        String password = GitBlitSuite.password;\r
 \r
        private static final AtomicBoolean started = new AtomicBoolean(false);\r
-       \r
-       private MultiConfigUtil multiConfigUtil = new MultiConfigUtil();\r
 \r
        @BeforeClass\r
        public static void startGitblit() throws Exception {\r
@@ -728,7 +726,7 @@ public class GitServletTest {
                        \r
                        // confirm default personal repository permissions\r
                        RepositoryModel model = GitBlit.self().getRepositoryModel(MessageFormat.format("~{0}/ticgit.git", user.username));\r
-                       assertEquals("Unexpected owner", user.username, multiConfigUtil.convertCollectionToSingleLineString(model.getRepoAdministrators()));\r
+                       assertEquals("Unexpected owner", user.username, ArrayUtils.toString(model.owners));\r
                        assertEquals("Unexpected authorization control", AuthorizationControl.NAMED, model.authorizationControl);\r
                        assertEquals("Unexpected access restriction", AccessRestrictionType.VIEW, model.accessRestriction);\r
                        \r
@@ -752,7 +750,7 @@ public class GitServletTest {
                        \r
                        // confirm default project repository permissions\r
                        RepositoryModel model = GitBlit.self().getRepositoryModel("project/ticgit.git");\r
-                       assertEquals("Unexpected owner", user.username, multiConfigUtil.convertCollectionToSingleLineString(model.getRepoAdministrators()));\r
+                       assertEquals("Unexpected owner", user.username, ArrayUtils.toString(model.owners));\r
                        assertEquals("Unexpected authorization control", AuthorizationControl.fromName(GitBlit.getString(Keys.git.defaultAuthorizationControl, "NAMED")), model.authorizationControl);\r
                        assertEquals("Unexpected access restriction", AccessRestrictionType.fromName(GitBlit.getString(Keys.git.defaultAccessRestriction, "NONE")), model.accessRestriction);\r
 \r
index 6eca046bc78b033849236a121a83498c4717a37f..5a951042216a232a3c9e1ad89dcc80b0a654115b 100644 (file)
@@ -2327,7 +2327,7 @@ public class PermissionsTest extends Assert {
                repository.accessRestriction = AccessRestrictionType.VIEW;
 
                UserModel user = new UserModel("test");
-               repository.addRepoAdministrator(user.username);
+               repository.addOwner(user.username);
 
                assertFalse("user SHOULD NOT HAVE a repository permission!", user.hasRepositoryPermission(repository.name));
                assertTrue("owner CAN NOT view!", user.canView(repository));
@@ -2344,6 +2344,51 @@ public class PermissionsTest extends Assert {
                assertTrue("owner CAN NOT edit!", user.canEdit(repository));
        }
        
+       @Test
+       public void testMultipleOwners() throws Exception {
+               RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date());
+               repository.authorizationControl = AuthorizationControl.NAMED;
+               repository.accessRestriction = AccessRestrictionType.VIEW;
+
+               UserModel user = new UserModel("test");
+               repository.addOwner(user.username);
+               UserModel user2 = new UserModel("test2");
+               repository.addOwner(user2.username);
+
+               // first owner
+               assertFalse("user SHOULD NOT HAVE a repository permission!", user.hasRepositoryPermission(repository.name));
+               assertTrue("owner CAN NOT view!", user.canView(repository));
+               assertTrue("owner CAN NOT clone!", user.canClone(repository));
+               assertTrue("owner CAN NOT push!", user.canPush(repository));
+               
+               assertTrue("owner CAN NOT create ref!", user.canCreateRef(repository));
+               assertTrue("owner CAN NOT delete ref!", user.canDeleteRef(repository));
+               assertTrue("owner CAN NOT rewind ref!", user.canRewindRef(repository));
+
+               assertTrue("owner CAN NOT fork!", user.canFork(repository));
+               
+               assertFalse("owner CAN NOT delete!", user.canDelete(repository));
+               assertTrue("owner CAN NOT edit!", user.canEdit(repository));
+               
+               // second owner
+               assertFalse("user SHOULD NOT HAVE a repository permission!", user2.hasRepositoryPermission(repository.name));
+               assertTrue("owner CAN NOT view!", user2.canView(repository));
+               assertTrue("owner CAN NOT clone!", user2.canClone(repository));
+               assertTrue("owner CAN NOT push!", user2.canPush(repository));
+               
+               assertTrue("owner CAN NOT create ref!", user2.canCreateRef(repository));
+               assertTrue("owner CAN NOT delete ref!", user2.canDeleteRef(repository));
+               assertTrue("owner CAN NOT rewind ref!", user2.canRewindRef(repository));
+
+               assertTrue("owner CAN NOT fork!", user2.canFork(repository));
+               
+               assertFalse("owner CAN NOT delete!", user2.canDelete(repository));
+               assertTrue("owner CAN NOT edit!", user2.canEdit(repository));
+               
+               assertTrue(repository.isOwner(user.username));
+               assertTrue(repository.isOwner(user2.username)); 
+       }
+       
        @Test
        public void testOwnerPersonalRepository() throws Exception {
                RepositoryModel repository = new RepositoryModel("~test/myrepo.git", null, null, new Date());
@@ -2351,7 +2396,7 @@ public class PermissionsTest extends Assert {
                repository.accessRestriction = AccessRestrictionType.VIEW;
 
                UserModel user = new UserModel("test");
-               repository.addRepoAdministrator(user.username);
+               repository.addOwner(user.username);
 
                assertFalse("user SHOULD NOT HAVE a repository permission!", user.hasRepositoryPermission(repository.name));
                assertTrue("user CAN NOT view!", user.canView(repository));
@@ -2375,7 +2420,7 @@ public class PermissionsTest extends Assert {
                repository.accessRestriction = AccessRestrictionType.VIEW;
 
                UserModel user = new UserModel("visitor");
-               repository.addRepoAdministrator("test");
+               repository.addOwner("test");
 
                assertFalse("user HAS a repository permission!", user.hasRepositoryPermission(repository.name));
                assertFalse("user CAN view!", user.canView(repository));
index 7228441f6a2e4cfb44a052fc73b89a36c6d29cf6..3241a8abbf790cc390724ca612afaea5f3119a62 100644 (file)
@@ -167,7 +167,7 @@ public class RpcTests {
                RepositoryModel model = new RepositoryModel();\r
                model.name = "garbagerepo.git";\r
                model.description = "created by RpcUtils";\r
-               model.addRepoAdministrator("garbage");\r
+               model.addOwner("garbage");\r
                model.accessRestriction = AccessRestrictionType.VIEW;\r
                model.authorizationControl = AuthorizationControl.AUTHENTICATED;\r
 \r