Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix valid permission regex not recognizing C perms or trailing Ms #2

Closed
wants to merge 1 commit into from

2 participants

@crocket

I cherry-picked a commit from gitolite-client so that gitlab would be able to create a wild repo.

@crocket

I'm closing it since it is obsolete.

@crocket crocket closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 9, 2012
  1. @wingrunr21

    Fix valid permission regex not recognizing C perms or trailing Ms

    wingrunr21 authored gitlab committed
This page is out of date. Refresh to see the latest.
Showing with 89 additions and 3 deletions.
  1. +2 −2 Gemfile.lock
  2. +1 −1  lib/gitolite/config/repo.rb
  3. +86 −0 spec/repo_spec.rb
View
4 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- gitolite (0.0.3.alpha)
+ gitolite (0.0.4.alpha)
grit (~> 2.4.1)
hashery (~> 1.4.0)
@@ -14,7 +14,7 @@ GEM
diff-lcs (~> 1.1)
mime-types (~> 1.15)
hashery (1.4.0)
- mime-types (1.16)
+ mime-types (1.17.2)
rcov (0.9.11)
rdoc (3.9.4)
rspec (2.6.0)
View
2  lib/gitolite/config/repo.rb
@@ -5,7 +5,7 @@ class Config
#Represents a repo inside the gitolite configuration. The name, permissions, and git config
#options are all encapsulated in this class
class Repo
- ALLOWED_PERMISSIONS = /-|R|RW+?C?D?/
+ ALLOWED_PERMISSIONS = /-|C|R|RW\+?(?:C?D?|D?C?)M?/
attr_accessor :permissions, :name, :config, :owner, :description
View
86 spec/repo_spec.rb
@@ -57,6 +57,92 @@
end
end
+ describe "permissions" do
+ before(:each) do
+ @repo = Gitolite::Config::Repo.new("CoolRepo")
+ end
+
+ it 'should allow adding the permission C' do
+ @repo.add_permission("C", "", "bob")
+ end
+
+ it 'should allow adding the permission -' do
+ @repo.add_permission("-", "", "bob")
+ end
+
+ it 'should allow adding the permission R' do
+ @repo.add_permission("R", "", "bob")
+ end
+
+ it 'should allow adding the permission RM' do
+ @repo.add_permission("RM", "", "bob")
+ end
+
+ it 'should allow adding the permission RW' do
+ @repo.add_permission("RW", "", "bob")
+ end
+
+ it 'should allow adding the permission RWM' do
+ @repo.add_permission("RWM", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+' do
+ @repo.add_permission("RW+", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+M' do
+ @repo.add_permission("RW+M", "", "bob")
+ end
+
+ it 'should allow adding the permission RWC' do
+ @repo.add_permission("RWC", "", "bob")
+ end
+
+ it 'should allow adding the permission RWCM' do
+ @repo.add_permission("RWCM", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+C' do
+ @repo.add_permission("RW+C", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+CM' do
+ @repo.add_permission("RW+CM", "", "bob")
+ end
+
+ it 'should allow adding the permission RWD' do
+ @repo.add_permission("RWD", "", "bob")
+ end
+
+ it 'should allow adding the permission RWDM' do
+ @repo.add_permission("RWDM", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+D' do
+ @repo.add_permission("RW+D", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+DM' do
+ @repo.add_permission("RW+DM", "", "bob")
+ end
+
+ it 'should allow adding the permission RWCD' do
+ @repo.add_permission("RWCD", "", "bob")
+ end
+
+ it 'should allow adding the permission RWCDM' do
+ @repo.add_permission("RWCDM", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+CD' do
+ @repo.add_permission("RW+CD", "", "bob")
+ end
+
+ it 'should allow adding the permission RW+CDM' do
+ @repo.add_permission("RW+CDM", "", "bob")
+ end
+ end
+
describe 'git config options' do
it 'should allow setting a git configuration option' do
email = "bob@zilla.com"
Something went wrong with that request. Please try again.