rubynas 0.1.0.pre.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/.gitignore +23 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +196 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +7 -0
- data/Procfile +2 -0
- data/README.md +151 -0
- data/Rakefile +14 -0
- data/Vagrantfile +99 -0
- data/bin/rubynas +63 -0
- data/config.ru +5 -0
- data/doc/README_FOR_APP +2 -0
- data/doc/macosx_shares.png +0 -0
- data/doc/shares_overview.png +0 -0
- data/lib/rubynas.rb +35 -0
- data/lib/rubynas/apis/group_api.rb +51 -0
- data/lib/rubynas/apis/system_information_api.rb +13 -0
- data/lib/rubynas/apis/user_api.rb +85 -0
- data/lib/rubynas/apis/volume_api.rb +50 -0
- data/lib/rubynas/config.rb +63 -0
- data/lib/rubynas/db/migrate/20130302164415_devise_create_users.rb +46 -0
- data/lib/rubynas/db/migrate/20130322143040_create_volumes.rb +10 -0
- data/lib/rubynas/db/migrate/20130331102556_create_shared_folders.rb +10 -0
- data/lib/rubynas/db/migrate/20130331103034_create_shared_folder_services.rb +11 -0
- data/lib/rubynas/installers/base_installer.rb +70 -0
- data/lib/rubynas/installers/debian_installer.rb +199 -0
- data/lib/rubynas/installers/ubuntu_installer.rb +2 -0
- data/lib/rubynas/installers/ubuntu_precise_installer.rb +2 -0
- data/lib/rubynas/models/.gitkeep +0 -0
- data/lib/rubynas/models/ldap_group.rb +21 -0
- data/lib/rubynas/models/ldap_org_unit.rb +13 -0
- data/lib/rubynas/models/ldap_user.rb +31 -0
- data/lib/rubynas/models/shared_folder.rb +32 -0
- data/lib/rubynas/models/shared_folder_service.rb +15 -0
- data/lib/rubynas/models/volume.rb +16 -0
- data/lib/rubynas/services/afp_share_service.rb +9 -0
- data/lib/rubynas/services/service.rb +4 -0
- data/lib/rubynas/services/share_service.rb +3 -0
- data/lib/rubynas/version.rb +3 -0
- data/rubynas.gemspec +69 -0
- data/rubynas.ini +24 -0
- data/sandbox/ldap/base.ldif +50 -0
- data/sandbox/ldap/data/.gitkeep +0 -0
- data/sandbox/ldap/data/dc=rubynas,dc=com.ldif +14 -0
- data/sandbox/ldap/local.schema +6 -0
- data/sandbox/ldap/schema/README +80 -0
- data/sandbox/ldap/schema/apple.schema +1727 -0
- data/sandbox/ldap/schema/apple_auxillary.schema +20 -0
- data/sandbox/ldap/schema/collective.ldif +48 -0
- data/sandbox/ldap/schema/collective.schema +190 -0
- data/sandbox/ldap/schema/corba.ldif +42 -0
- data/sandbox/ldap/schema/corba.schema +239 -0
- data/sandbox/ldap/schema/core.ldif +591 -0
- data/sandbox/ldap/schema/core.schema +610 -0
- data/sandbox/ldap/schema/cosine.ldif +200 -0
- data/sandbox/ldap/schema/cosine.schema +2571 -0
- data/sandbox/ldap/schema/duaconf.ldif +83 -0
- data/sandbox/ldap/schema/duaconf.schema +261 -0
- data/sandbox/ldap/schema/dyngroup.ldif +71 -0
- data/sandbox/ldap/schema/dyngroup.schema +91 -0
- data/sandbox/ldap/schema/fmserver.schema +60 -0
- data/sandbox/ldap/schema/inetorgperson.ldif +69 -0
- data/sandbox/ldap/schema/inetorgperson.schema +155 -0
- data/sandbox/ldap/schema/java.ldif +59 -0
- data/sandbox/ldap/schema/java.schema +403 -0
- data/sandbox/ldap/schema/krb5-kdc.schema +134 -0
- data/sandbox/ldap/schema/microsoft.ext.schema +5383 -0
- data/sandbox/ldap/schema/microsoft.schema +4835 -0
- data/sandbox/ldap/schema/microsoft.std.schema +480 -0
- data/sandbox/ldap/schema/misc.ldif +45 -0
- data/sandbox/ldap/schema/misc.schema +75 -0
- data/sandbox/ldap/schema/netinfo.schema +240 -0
- data/sandbox/ldap/schema/nis.ldif +120 -0
- data/sandbox/ldap/schema/nis.schema +241 -0
- data/sandbox/ldap/schema/openldap.ldif +88 -0
- data/sandbox/ldap/schema/openldap.schema +54 -0
- data/sandbox/ldap/schema/pmi.ldif +123 -0
- data/sandbox/ldap/schema/pmi.schema +464 -0
- data/sandbox/ldap/schema/ppolicy.ldif +75 -0
- data/sandbox/ldap/schema/ppolicy.schema +531 -0
- data/sandbox/ldap/schema/samba.schema +179 -0
- data/sandbox/ldap/slapd.conf +99 -0
- data/spec/apis/group_api_spec.rb +97 -0
- data/spec/apis/system_information_api_spec.rb +27 -0
- data/spec/apis/user_api_spec.rb +113 -0
- data/spec/apis/volume_api_spec.rb +98 -0
- data/spec/factories/ldap_group.rb +16 -0
- data/spec/factories/ldap_users.rb +24 -0
- data/spec/factories/shared_folder_services.rb +9 -0
- data/spec/factories/shared_folders.rb +15 -0
- data/spec/factories/users.rb +8 -0
- data/spec/factories/volumes.rb +10 -0
- data/spec/installer/base_installer_spec.rb +35 -0
- data/spec/installer/debian_installer_spec.rb +86 -0
- data/spec/models/ldap_group_spec.rb +21 -0
- data/spec/models/ldap_org_unit_spec.rb +19 -0
- data/spec/models/ldap_user_spec.rb +19 -0
- data/spec/models/shared_folder_service_spec.rb +25 -0
- data/spec/models/shared_folder_spec.rb +27 -0
- data/spec/models/volume_spec.rb +5 -0
- data/spec/services/afp_share_service_spec.rb +5 -0
- data/spec/services/service_spec.rb +5 -0
- data/spec/services/share_service_spec.rb +5 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/support/db_cleaner.rb +16 -0
- data/spec/support/factory_girl.rb +7 -0
- data/spec/support/logger.rb +1 -0
- data/spec/support/rack-test.rb +6 -0
- metadata +633 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
##
|
|
2
|
+
## schema file for OpenLDAP 2.0.x
|
|
3
|
+
## Schema for storing Samba's smbpasswd file in LDAP
|
|
4
|
+
## OIDs are owned by the Samba Team
|
|
5
|
+
##
|
|
6
|
+
## Prerequisite schemas - uid (cosine.schema)
|
|
7
|
+
## - displayName (inetorgperson.schema)
|
|
8
|
+
##
|
|
9
|
+
## 1.3.6.1.4.1.7165.2.1.x - attributetypes
|
|
10
|
+
## 1.3.6.1.4.1.7165.2.2.x - objectclasses
|
|
11
|
+
##
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
## Password hashes
|
|
15
|
+
##
|
|
16
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.1 NAME 'lmPassword'
|
|
17
|
+
DESC 'LanManager Passwd'
|
|
18
|
+
EQUALITY caseIgnoreIA5Match
|
|
19
|
+
SUBSTR caseIgnoreIA5SubstringsMatch
|
|
20
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
|
|
21
|
+
|
|
22
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.2 NAME 'ntPassword'
|
|
23
|
+
DESC 'NT Passwd'
|
|
24
|
+
EQUALITY caseIgnoreIA5Match
|
|
25
|
+
SUBSTR caseIgnoreIA5SubstringsMatch
|
|
26
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
## Account flags in string format ([UWDX ])
|
|
30
|
+
##
|
|
31
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.4 NAME 'acctFlags'
|
|
32
|
+
DESC 'Account Flags'
|
|
33
|
+
EQUALITY caseIgnoreIA5Match
|
|
34
|
+
SUBSTR caseIgnoreIA5SubstringsMatch
|
|
35
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
## Password timestamps & policies
|
|
39
|
+
##
|
|
40
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.3 NAME 'pwdLastSet'
|
|
41
|
+
DESC 'NT pwdLastSet'
|
|
42
|
+
EQUALITY integerMatch
|
|
43
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
44
|
+
|
|
45
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.5 NAME 'logonTime'
|
|
46
|
+
DESC 'NT logonTime'
|
|
47
|
+
EQUALITY integerMatch
|
|
48
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
49
|
+
|
|
50
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.6 NAME 'logoffTime'
|
|
51
|
+
DESC 'NT logoffTime'
|
|
52
|
+
EQUALITY integerMatch
|
|
53
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
54
|
+
|
|
55
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.7 NAME 'kickoffTime'
|
|
56
|
+
DESC 'NT kickoffTime'
|
|
57
|
+
EQUALITY integerMatch
|
|
58
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
59
|
+
|
|
60
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.8 NAME 'pwdCanChange'
|
|
61
|
+
DESC 'NT pwdCanChange'
|
|
62
|
+
EQUALITY integerMatch
|
|
63
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
64
|
+
|
|
65
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.9 NAME 'pwdMustChange'
|
|
66
|
+
DESC 'NT pwdMustChange'
|
|
67
|
+
EQUALITY integerMatch
|
|
68
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
## string settings
|
|
72
|
+
##
|
|
73
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.10 NAME 'homeDrive'
|
|
74
|
+
DESC 'NT homeDrive'
|
|
75
|
+
EQUALITY caseIgnoreIA5Match
|
|
76
|
+
SUBSTR caseIgnoreIA5SubstringsMatch
|
|
77
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
|
|
78
|
+
|
|
79
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.11 NAME 'scriptPath'
|
|
80
|
+
DESC 'NT scriptPath'
|
|
81
|
+
EQUALITY caseIgnoreMatch
|
|
82
|
+
SUBSTR caseIgnoreSubstringsMatch
|
|
83
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
|
84
|
+
|
|
85
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.12 NAME 'profilePath'
|
|
86
|
+
DESC 'NT profilePath'
|
|
87
|
+
EQUALITY caseIgnoreMatch
|
|
88
|
+
SUBSTR caseIgnoreSubstringsMatch
|
|
89
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
|
90
|
+
|
|
91
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.13 NAME 'userWorkstations'
|
|
92
|
+
DESC 'userWorkstations'
|
|
93
|
+
EQUALITY caseIgnoreMatch
|
|
94
|
+
SUBSTR caseIgnoreSubstringsMatch
|
|
95
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
|
96
|
+
|
|
97
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.17 NAME 'smbHome'
|
|
98
|
+
DESC 'smbHome'
|
|
99
|
+
EQUALITY caseIgnoreMatch
|
|
100
|
+
SUBSTR caseIgnoreSubstringsMatch
|
|
101
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
|
|
102
|
+
|
|
103
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.18 NAME 'domain'
|
|
104
|
+
DESC 'Windows NT domain to which the user belongs'
|
|
105
|
+
EQUALITY caseIgnoreIA5Match
|
|
106
|
+
SUBSTR caseIgnoreIA5SubstringsMatch
|
|
107
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
## user and group RID
|
|
111
|
+
##
|
|
112
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.14 NAME 'rid'
|
|
113
|
+
DESC 'NT rid'
|
|
114
|
+
EQUALITY integerMatch
|
|
115
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
116
|
+
|
|
117
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.15 NAME 'primaryGroupID'
|
|
118
|
+
DESC 'NT Group RID'
|
|
119
|
+
EQUALITY integerMatch
|
|
120
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
|
|
121
|
+
|
|
122
|
+
##
|
|
123
|
+
## The smbPasswordEntry objectclass has been depreciated in favor of the
|
|
124
|
+
## sambaAccount objectclass
|
|
125
|
+
##
|
|
126
|
+
#objectclass ( 1.3.6.1.4.1.7165.2.2.1 NAME 'smbPasswordEntry' SUP top AUXILIARY
|
|
127
|
+
# DESC 'Samba smbpasswd entry'
|
|
128
|
+
# MUST ( uid $ uidNumber )
|
|
129
|
+
# MAY ( lmPassword $ ntPassword $ pwdLastSet $ acctFlags ))
|
|
130
|
+
|
|
131
|
+
#objectclass ( 1.3.6.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL
|
|
132
|
+
# DESC 'Samba Account'
|
|
133
|
+
# MUST ( uid $ rid )
|
|
134
|
+
# MAY ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
|
|
135
|
+
# logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
|
|
136
|
+
# displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
|
|
137
|
+
# description $ userWorkstations $ primaryGroupID $ domain ))
|
|
138
|
+
|
|
139
|
+
## The X.500 data model (and therefore LDAPv3) says that each entry can
|
|
140
|
+
## only have one structural objectclass. OpenLDAP 2.0 does not enforce
|
|
141
|
+
## this currently but will in v2.1
|
|
142
|
+
|
|
143
|
+
objectclass ( 1.3.6.1.4.1.7165.2.2.3 NAME 'sambaAccount' SUP top AUXILIARY
|
|
144
|
+
DESC 'Samba Auxilary Account'
|
|
145
|
+
MUST ( uid $ rid )
|
|
146
|
+
MAY ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
|
|
147
|
+
logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
|
|
148
|
+
displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
|
|
149
|
+
description $ userWorkstations $ primaryGroupID $ domain ))
|
|
150
|
+
|
|
151
|
+
##
|
|
152
|
+
## Used for Winbind experimentation
|
|
153
|
+
##
|
|
154
|
+
#objectclass ( 1.3.6.1.4.1.7165.1.2.2.3 NAME 'uidPool' SUP top AUXILIARY
|
|
155
|
+
# DESC 'Pool for allocating UNIX uids'
|
|
156
|
+
# MUST ( uidNumber $ cn ) )
|
|
157
|
+
|
|
158
|
+
#objectclass ( 1.3.6.1.4.1.7165.1.2.2.4 NAME 'gidPool' SUP top AUXILIARY
|
|
159
|
+
# DESC 'Pool for allocating UNIX gids'
|
|
160
|
+
# MUST ( gidNumber $ cn ) )
|
|
161
|
+
|
|
162
|
+
##
|
|
163
|
+
## SID, of any type
|
|
164
|
+
##
|
|
165
|
+
|
|
166
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.20 NAME 'sambaSID'
|
|
167
|
+
DESC 'Security ID'
|
|
168
|
+
EQUALITY caseIgnoreIA5Match
|
|
169
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
##
|
|
173
|
+
## Primary group SID, compatible with ntSid
|
|
174
|
+
##
|
|
175
|
+
|
|
176
|
+
attributetype ( 1.3.6.1.4.1.7165.2.1.23 NAME 'sambaPrimaryGroupSID'
|
|
177
|
+
DESC 'Primary Group Security ID'
|
|
178
|
+
EQUALITY caseIgnoreIA5Match
|
|
179
|
+
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#
|
|
2
|
+
# See slapd.conf(5) for details on configuration options.
|
|
3
|
+
# This file should NOT be world readable.
|
|
4
|
+
#
|
|
5
|
+
include sandbox/ldap/schema/core.schema
|
|
6
|
+
include sandbox/ldap/schema/cosine.schema
|
|
7
|
+
include sandbox/ldap/schema/inetorgperson.schema
|
|
8
|
+
include sandbox/ldap/schema/nis.schema
|
|
9
|
+
|
|
10
|
+
## Local definitions
|
|
11
|
+
include sandbox/ldap/local.schema
|
|
12
|
+
|
|
13
|
+
# Allow LDAPv2 client connections. This is NOT the default.
|
|
14
|
+
allow bind_v2
|
|
15
|
+
|
|
16
|
+
# Do not enable referrals until AFTER you have a working directory
|
|
17
|
+
# service AND an understanding of referrals.
|
|
18
|
+
#referral ldap://root.openldap.org
|
|
19
|
+
|
|
20
|
+
pidfile sandbox/ldap/data/slapd.pid
|
|
21
|
+
argsfile sandbox/ldap/data/slapd.args
|
|
22
|
+
|
|
23
|
+
# Load dynamic backend modules:
|
|
24
|
+
modulepath /usr/lib/openldap
|
|
25
|
+
|
|
26
|
+
# modules available in openldap-servers-overlays RPM package:
|
|
27
|
+
# moduleload accesslog.la
|
|
28
|
+
# moduleload auditlog.la
|
|
29
|
+
# moduleload denyop.la
|
|
30
|
+
# moduleload dyngroup.la
|
|
31
|
+
# moduleload dynlist.la
|
|
32
|
+
# moduleload lastmod.la
|
|
33
|
+
# moduleload pcache.la
|
|
34
|
+
# moduleload ppolicy.la
|
|
35
|
+
# moduleload refint.la
|
|
36
|
+
# moduleload retcode.la
|
|
37
|
+
# moduleload rwm.la
|
|
38
|
+
# moduleload smbk5pwd.la
|
|
39
|
+
# moduleload syncprov.la
|
|
40
|
+
# moduleload translucent.la
|
|
41
|
+
# moduleload unique.la
|
|
42
|
+
# moduleload valsort.la
|
|
43
|
+
|
|
44
|
+
# modules available in openldap-servers-sql RPM package:
|
|
45
|
+
# moduleload back_sql.la
|
|
46
|
+
|
|
47
|
+
# The next three lines allow use of TLS for encrypting connections using a
|
|
48
|
+
# dummy test certificate which you can generate by changing to
|
|
49
|
+
# /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
|
|
50
|
+
# slapd.pem so that the ldap user or group can read it. Your client software
|
|
51
|
+
# may balk at self-signed certificates, however.
|
|
52
|
+
|
|
53
|
+
# ## For LDAPS
|
|
54
|
+
# TLSCACertificateFile "config/CACertificateFile.pem"
|
|
55
|
+
# TLSCertificateFile "config/CertificateFile.pem"
|
|
56
|
+
# TLSCertificateKeyFile "config/CertificateKeyFile.pem"
|
|
57
|
+
#
|
|
58
|
+
# TLSVerifyClient demand
|
|
59
|
+
|
|
60
|
+
# Sample security restrictions
|
|
61
|
+
# Require integrity protection (prevent hijacking)
|
|
62
|
+
# Require 112-bit (3DES or better) encryption for updates
|
|
63
|
+
# Require 63-bit encryption for simple bind
|
|
64
|
+
# security ssf=1 update_ssf=112 simple_bind=64
|
|
65
|
+
|
|
66
|
+
# Sample access control policy:
|
|
67
|
+
# Root DSE: allow anyone to read it
|
|
68
|
+
# Subschema (sub)entry DSE: allow anyone to read it
|
|
69
|
+
# Other DSEs:
|
|
70
|
+
# Allow self write access
|
|
71
|
+
# Allow authenticated users read access
|
|
72
|
+
# Allow anonymous users to authenticate
|
|
73
|
+
# Directives needed to implement policy:
|
|
74
|
+
|
|
75
|
+
# access to dn.base="dc=esc" by * read
|
|
76
|
+
# access to dn.base="cn=Subschema" by * read
|
|
77
|
+
access to *
|
|
78
|
+
by self write
|
|
79
|
+
by * read
|
|
80
|
+
by anonymous auth
|
|
81
|
+
|
|
82
|
+
#
|
|
83
|
+
# if no access controls are present, the default policy
|
|
84
|
+
# allows anyone and everyone to read anything but restricts
|
|
85
|
+
# updates to rootdn. (e.g., "access to * by * read")
|
|
86
|
+
#
|
|
87
|
+
# rootdn can always read and write EVERYTHING!
|
|
88
|
+
|
|
89
|
+
#######################################################################
|
|
90
|
+
# ldbm and/or bdb database definitions
|
|
91
|
+
#######################################################################
|
|
92
|
+
|
|
93
|
+
database ldif
|
|
94
|
+
|
|
95
|
+
suffix "dc=rubynas,dc=com"
|
|
96
|
+
directory sandbox/ldap/data
|
|
97
|
+
rootdn "cn=admin,dc=rubynas,dc=com"
|
|
98
|
+
## rootpw = secret
|
|
99
|
+
rootpw {SSHA}fFjKcZb4cfOAcwSjJer8nCGOEVRUnwCC
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Restful Group API' do
|
|
4
|
+
include Rack::Test::Methods
|
|
5
|
+
|
|
6
|
+
def app
|
|
7
|
+
GroupApi
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
before { LdapGroup.all.each(&:destroy) }
|
|
11
|
+
|
|
12
|
+
context "GET /" do
|
|
13
|
+
before do
|
|
14
|
+
create :user_ldap_group
|
|
15
|
+
create :admin_ldap_group
|
|
16
|
+
get '/'
|
|
17
|
+
end
|
|
18
|
+
subject { last_response }
|
|
19
|
+
|
|
20
|
+
it { should be_ok }
|
|
21
|
+
its(:body) { should include('Users') }
|
|
22
|
+
its(:body) { should include('Administrators') }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "GET /:cn" do
|
|
26
|
+
context "with group" do
|
|
27
|
+
before do
|
|
28
|
+
create :user_ldap_group
|
|
29
|
+
get '/Users'
|
|
30
|
+
end
|
|
31
|
+
subject { last_response }
|
|
32
|
+
|
|
33
|
+
it { should be_ok }
|
|
34
|
+
its(:body) { should include('Users') }
|
|
35
|
+
its(:body) { should include('1000') }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "without user" do
|
|
39
|
+
before { get '/Users' }
|
|
40
|
+
subject { last_response }
|
|
41
|
+
|
|
42
|
+
its(:status) { should == 404 }
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "DELETE /" do
|
|
47
|
+
context "with group" do
|
|
48
|
+
before do
|
|
49
|
+
create :user_ldap_group
|
|
50
|
+
LdapGroup.all.should_not be_empty
|
|
51
|
+
delete '/Users'
|
|
52
|
+
end
|
|
53
|
+
subject { last_response }
|
|
54
|
+
|
|
55
|
+
it { should be_ok }
|
|
56
|
+
specify { LdapGroup.all.should be_empty }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
context "without user" do
|
|
60
|
+
before { delete '/Users' }
|
|
61
|
+
subject { last_response }
|
|
62
|
+
|
|
63
|
+
its(:status) { should == 404 }
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context "POST /" do
|
|
68
|
+
it "adds a new group" do
|
|
69
|
+
post '/', common_name: "Foo", gid_number: 1001
|
|
70
|
+
last_response.status.should == 201
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "returns a 400 if params are missing" do
|
|
74
|
+
post '/'
|
|
75
|
+
last_response.status.should == 400
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
context "PUT /:cn" do
|
|
80
|
+
context "with user" do
|
|
81
|
+
before do
|
|
82
|
+
create :user_ldap_group
|
|
83
|
+
put '/Users', common_name: "Foo", gid_number: 1001
|
|
84
|
+
end
|
|
85
|
+
subject { LdapGroup.find('Users') }
|
|
86
|
+
|
|
87
|
+
its(:gid_number) { should == 1001 }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context "without user" do
|
|
91
|
+
before { put '/Users', common_name: "Foo", gid_number: 1001 }
|
|
92
|
+
subject { last_response }
|
|
93
|
+
|
|
94
|
+
its(:status) { should == 404 }
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SystemInformationApi do
|
|
4
|
+
include Rack::Test::Methods
|
|
5
|
+
|
|
6
|
+
def app
|
|
7
|
+
described_class
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe "GET /vmstat" do
|
|
11
|
+
before do
|
|
12
|
+
get '/vmstat'
|
|
13
|
+
end
|
|
14
|
+
subject { last_response }
|
|
15
|
+
|
|
16
|
+
it { should be_ok }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "GET /disk/" do
|
|
20
|
+
before do
|
|
21
|
+
get '/disk/'
|
|
22
|
+
end
|
|
23
|
+
subject { last_response }
|
|
24
|
+
|
|
25
|
+
it { should be_ok }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Restful User API' do
|
|
4
|
+
include Rack::Test::Methods
|
|
5
|
+
|
|
6
|
+
def app
|
|
7
|
+
UserApi
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
before { LdapUser.all.each(&:destroy) }
|
|
11
|
+
|
|
12
|
+
context "GET /" do
|
|
13
|
+
before do
|
|
14
|
+
create :ldap_user
|
|
15
|
+
create :admin_ldap_user
|
|
16
|
+
get '/'
|
|
17
|
+
end
|
|
18
|
+
subject { last_response }
|
|
19
|
+
|
|
20
|
+
it { should be_ok }
|
|
21
|
+
its(:body) { should include('user@rubynas.com') }
|
|
22
|
+
its(:body) { should include('admin@rubynas.com') }
|
|
23
|
+
its(:body) { should_not include('userPassword') }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context "GET /template" do
|
|
27
|
+
before do
|
|
28
|
+
get '/template'
|
|
29
|
+
end
|
|
30
|
+
subject { last_response }
|
|
31
|
+
|
|
32
|
+
it { should be_ok }
|
|
33
|
+
its(:body) { should include('1000') }
|
|
34
|
+
its(:body) { should include('/home/') }
|
|
35
|
+
|
|
36
|
+
context "with one user" do
|
|
37
|
+
before do
|
|
38
|
+
create :ldap_user
|
|
39
|
+
get '/template'
|
|
40
|
+
end
|
|
41
|
+
subject { last_response }
|
|
42
|
+
|
|
43
|
+
it { should be_ok }
|
|
44
|
+
its(:body) { should include('1001') }
|
|
45
|
+
its(:body) { should include('/home/') }
|
|
46
|
+
its(:body) { should include('1000') } # group
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context "POST /" do
|
|
51
|
+
it "creates a new user" do
|
|
52
|
+
post '/', :common_name => 'John Doe',
|
|
53
|
+
:uid => 'jdoe',
|
|
54
|
+
:home_directory => '/tmp',
|
|
55
|
+
:gid_number => 1000,
|
|
56
|
+
:uid_number => 1000,
|
|
57
|
+
:given_name => "John",
|
|
58
|
+
:surname => "Doe",
|
|
59
|
+
:mail => "john.doe@rubynas.com",
|
|
60
|
+
:password => 'password',
|
|
61
|
+
:login_shell => '/bin/bash'
|
|
62
|
+
last_response.status.should == 201
|
|
63
|
+
user = LdapUser.find('John Doe')
|
|
64
|
+
user.should be_a(LdapUser)
|
|
65
|
+
ActiveLdap::UserPassword.valid?('password',
|
|
66
|
+
user.user_password).should be_true
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "doesn't create a new user if fields are missing" do
|
|
70
|
+
LdapUser.should_not_receive(:create)
|
|
71
|
+
post '/', :common_name => 'John Doe',
|
|
72
|
+
:uid => 'jdoe',
|
|
73
|
+
:home_directory => '/tmp',
|
|
74
|
+
:gid_number => 1000,
|
|
75
|
+
:uid_number => 1000
|
|
76
|
+
last_response.should_not be_ok
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
context "GET /user/cn" do
|
|
81
|
+
it "searches with filter" do
|
|
82
|
+
create :ldap_user
|
|
83
|
+
get '/User'
|
|
84
|
+
last_response.should be_ok
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
context "DELETE /user/cn" do
|
|
89
|
+
it "searches with filter" do
|
|
90
|
+
create :ldap_user
|
|
91
|
+
delete '/User'
|
|
92
|
+
last_response.status.should == 200
|
|
93
|
+
expect { LdapUser.find("User") }.to raise_error(ActiveLdap::EntryNotFound)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
context "PUT /user/cn" do
|
|
98
|
+
it "updates the user" do
|
|
99
|
+
create :ldap_user
|
|
100
|
+
put '/User', :uid_number => 2000
|
|
101
|
+
last_response.should be_ok
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "updates the user password" do
|
|
105
|
+
create :ldap_user
|
|
106
|
+
put '/User', :password => "foobar"
|
|
107
|
+
last_response.should be_ok
|
|
108
|
+
user = LdapUser.find('User')
|
|
109
|
+
ActiveLdap::UserPassword.valid?("foobar",
|
|
110
|
+
user.user_password).should be_true
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|