brownbeagle-gitauth 0.0.4.0 → 0.0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/gitauth +43 -3
- data/lib/gitauth.rb +1 -1
- data/lib/gitauth/user.rb +8 -0
- metadata +32 -11
- data/Rakefile +0 -19
- data/gitauth.gemspec +0 -28
data/bin/gitauth
CHANGED
@@ -74,12 +74,13 @@ GitAuth::Application.processing(ARGV) do |a|
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
-
a.controller!
|
77
|
+
a.controller!(:web_app, "Starts the gitauth frontend using the default sintra runner", :skip_path => true)
|
78
78
|
|
79
79
|
a.option(:force, "Skip the verification / confirmation part of adding the permissions")
|
80
80
|
a.option(:type, "The type of permissions - one of all, read, write or none. Defaults to all")
|
81
|
-
full_desc = "Gives a specific user or group the specified permissions to a given repository
|
81
|
+
full_desc = "Gives a specific user or group the specified permissions to a given repository"
|
82
82
|
a.add("permissions REPOSITORY USER-OR-GROUP", full_desc) do |repo, target, options|
|
83
|
+
GitAuth.prepare
|
83
84
|
permissions = options[:type] || 'all'
|
84
85
|
|
85
86
|
if !%w(all read write none).include? permissions
|
@@ -100,7 +101,7 @@ GitAuth::Application.processing(ARGV) do |a|
|
|
100
101
|
puts "Permissions not added, exiting."
|
101
102
|
end
|
102
103
|
end
|
103
|
-
|
104
|
+
|
104
105
|
a.option(:admin, "Makes a user an admin user")
|
105
106
|
a.add("add-user NAME PATH-TO-PUBLIC-KEY", "Creates a user with a given public key") do |name, ssh_key, options|
|
106
107
|
GitAuth.prepare
|
@@ -192,4 +193,43 @@ GitAuth::Application.processing(ARGV) do |a|
|
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
196
|
+
a.add("show-repo NAME", "Shows information for a repository with a given name") do |name, options|
|
197
|
+
GitAuth.prepare
|
198
|
+
repo = GitAuth::Repo.get(name)
|
199
|
+
die! "Unknown repository '#{repo}'" if repo.blank?
|
200
|
+
puts "Repository Name: #{repo.name}"
|
201
|
+
puts "Repository Path: #{repo.path}"
|
202
|
+
puts "Actual Path: #{repo.real_path}"
|
203
|
+
puts "\nRead Permissions:"
|
204
|
+
read_perms = repo.permissions.fetch(:read, [])
|
205
|
+
read_perms.each { |item| puts " - #{item}" }
|
206
|
+
puts " - No read permissions" if read_perms.blank?
|
207
|
+
puts "\nWrite Permissions:"
|
208
|
+
write_perms = repo.permissions.fetch(:write, [])
|
209
|
+
write_perms.each { |item| puts " - #{item}" }
|
210
|
+
puts " - No write permissions" if write_perms.blank?
|
211
|
+
end
|
212
|
+
|
213
|
+
a.add("show-group NAME", "Shows information for a group with a given name") do |name, options|
|
214
|
+
GitAuth.prepare
|
215
|
+
group = GitAuth::Group.get(name)
|
216
|
+
die! "Unable to find a group named '#{name}'" if group.blank?
|
217
|
+
puts "Group Name: #{group.name}"
|
218
|
+
puts "Reference Name: #{group.to_s}"
|
219
|
+
puts "\nGroup Members:"
|
220
|
+
group.members.each { |member| puts " - #{member}" }
|
221
|
+
puts " - This group has no members" if group.members.blank?
|
222
|
+
end
|
223
|
+
|
224
|
+
a.add("show-user NAME", "Shows details for a user with a specific name") do |name, options|
|
225
|
+
GitAuth.prepare
|
226
|
+
user = GitAuth::User.get(name)
|
227
|
+
die! "Unable to find a user named '#{name}'" if user.blank?
|
228
|
+
puts "User Name: #{user.name}"
|
229
|
+
groups = user.groups
|
230
|
+
puts "\nGroups:"
|
231
|
+
puts " - This user isn't a member of any groups" if groups.blank?
|
232
|
+
groups.each { |g| puts " - #{g.to_s}" }
|
233
|
+
end
|
234
|
+
|
195
235
|
end
|
data/lib/gitauth.rb
CHANGED
@@ -21,7 +21,7 @@ require 'ostruct'
|
|
21
21
|
|
22
22
|
module GitAuth
|
23
23
|
|
24
|
-
VERSION = [0, 0, 4,
|
24
|
+
VERSION = [0, 0, 4, 1]
|
25
25
|
BASE_DIR = Pathname.new(__FILE__).dirname.join("..").expand_path
|
26
26
|
LIB_DIR = BASE_DIR.join("lib", "gitauth")
|
27
27
|
GITAUTH_DIR = Pathname.new("~/.gitauth/").expand_path
|
data/lib/gitauth/user.rb
CHANGED
@@ -88,6 +88,10 @@ module GitAuth
|
|
88
88
|
GitAuth::Group.save!
|
89
89
|
end
|
90
90
|
|
91
|
+
def groups
|
92
|
+
(Group.all || []).select { |g| g.member?(self) }
|
93
|
+
end
|
94
|
+
|
91
95
|
def admin?
|
92
96
|
!!@admin
|
93
97
|
end
|
@@ -121,6 +125,10 @@ module GitAuth
|
|
121
125
|
end
|
122
126
|
end
|
123
127
|
|
128
|
+
def self.valid_key?(key)
|
129
|
+
clean_ssh_key(key).present?
|
130
|
+
end
|
131
|
+
|
124
132
|
end
|
125
133
|
Users = User # For Backwards Compat.
|
126
134
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brownbeagle-gitauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4.
|
4
|
+
version: 0.0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
@@ -11,8 +11,37 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2009-09-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack-rack
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "1.0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sinatra-sinatra
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.0
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: Sutto-perennial
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
16
45
|
description: A library to enable per user / group authentication on a read / write basis for git repositories running over ssh
|
17
46
|
email: sutto@sutto.net
|
18
47
|
executables:
|
@@ -25,14 +54,10 @@ extra_rdoc_files: []
|
|
25
54
|
files:
|
26
55
|
- LICENSE
|
27
56
|
- README.rdoc
|
28
|
-
- Rakefile
|
29
57
|
- USAGE
|
30
|
-
- bin
|
31
58
|
- bin/gitauth
|
32
59
|
- bin/gitauth-shell
|
33
60
|
- config.ru
|
34
|
-
- gitauth.gemspec
|
35
|
-
- lib
|
36
61
|
- lib/gitauth
|
37
62
|
- lib/gitauth.rb
|
38
63
|
- lib/gitauth/auth_setup_middleware.rb
|
@@ -45,14 +70,10 @@ files:
|
|
45
70
|
- lib/gitauth/settings.rb
|
46
71
|
- lib/gitauth/user.rb
|
47
72
|
- lib/gitauth/web_app.rb
|
48
|
-
- public
|
49
73
|
- public/gitauth.css
|
50
74
|
- public/gitauth.js
|
51
75
|
- public/jquery.js
|
52
|
-
- resources
|
53
76
|
- resources/messages.yml
|
54
|
-
- vendor
|
55
|
-
- views
|
56
77
|
- views/auth_setup.erb
|
57
78
|
- views/clone_repo.erb
|
58
79
|
- views/group.erb
|
data/Rakefile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
|
3
|
-
task :gemspec do
|
4
|
-
require 'rubygems'
|
5
|
-
require File.join(File.dirname(__FILE__), "lib", "gitauth")
|
6
|
-
spec = Gem::Specification.new do |s|
|
7
|
-
s.name = 'gitauth'
|
8
|
-
s.email = 'sutto@sutto.net'
|
9
|
-
s.homepage = 'http://brownbeagle.com.au/'
|
10
|
-
s.authors = ["Darcy Laycock"]
|
11
|
-
s.version = GitAuth.version
|
12
|
-
s.summary = "An authentication manager for Git repositories served over SSH"
|
13
|
-
s.description = "A library to enable per user / group authentication on a read / write basis for git repositories running over ssh"
|
14
|
-
s.files = (FileList["{bin,lib,public,resources,views}/**/*"].to_a + FileList["*"].to_a).sort
|
15
|
-
s.executables = FileList["bin/*"].to_a.map { |f| File.basename(f) }
|
16
|
-
s.platform = Gem::Platform::RUBY
|
17
|
-
end
|
18
|
-
File.open("gitauth.gemspec", "w+") { |f| f.puts spec.to_ruby }
|
19
|
-
end
|
data/gitauth.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{gitauth}
|
5
|
-
s.version = "0.0.4.0"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Darcy Laycock"]
|
9
|
-
s.date = %q{2009-09-06}
|
10
|
-
s.description = %q{A library to enable per user / group authentication on a read / write basis for git repositories running over ssh}
|
11
|
-
s.email = %q{sutto@sutto.net}
|
12
|
-
s.executables = ["gitauth", "gitauth-shell"]
|
13
|
-
s.files = ["LICENSE", "README.rdoc", "Rakefile", "USAGE", "bin", "bin/gitauth", "bin/gitauth-shell", "config.ru", "gitauth.gemspec", "lib", "lib/gitauth", "lib/gitauth.rb", "lib/gitauth/auth_setup_middleware.rb", "lib/gitauth/client.rb", "lib/gitauth/command.rb", "lib/gitauth/group.rb", "lib/gitauth/message.rb", "lib/gitauth/repo.rb", "lib/gitauth/saveable_class.rb", "lib/gitauth/settings.rb", "lib/gitauth/user.rb", "lib/gitauth/web_app.rb", "public", "public/gitauth.css", "public/gitauth.js", "public/jquery.js", "resources", "resources/messages.yml", "vendor", "views", "views/auth_setup.erb", "views/clone_repo.erb", "views/group.erb", "views/index.erb", "views/layout.erb", "views/repo.erb", "views/user.erb"]
|
14
|
-
s.homepage = %q{http://brownbeagle.com.au/}
|
15
|
-
s.require_paths = ["lib"]
|
16
|
-
s.rubygems_version = %q{1.3.2}
|
17
|
-
s.summary = %q{An authentication manager for Git repositories served over SSH}
|
18
|
-
|
19
|
-
if s.respond_to? :specification_version then
|
20
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
21
|
-
s.specification_version = 3
|
22
|
-
|
23
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
24
|
-
else
|
25
|
-
end
|
26
|
-
else
|
27
|
-
end
|
28
|
-
end
|