cratus 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f416f10ddf55e3793e1c74b6a366298c49784234
4
- data.tar.gz: b81b929aaea8e813d3f2077ce683888e4ac5bf4d
3
+ metadata.gz: 95854c5b9a4fc245547081d9a0b87b59c68262d8
4
+ data.tar.gz: 2a74ec2d2bc5078a22217315b55c7c6679109023
5
5
  SHA512:
6
- metadata.gz: 683028dbe910819bf36a842f01a88ceedeb5ca4b5b13f33c9b11501d9a8ed906296ea0a982830cf2a40ed514eda9e86a7b18f5d0173247048920eaeff1191b48
7
- data.tar.gz: aa0671bc02866fab124a1361ad5187594e5c10ef90c390e2de5052ce35be50e731e4f9abc0e119806d1fbdaf37fb46ecc7d0cf56049c80dcf4f5df07e07a4d64
6
+ metadata.gz: db3ae770253d2b97fbb5dacf1b75d63c4fe886fba393bf03e8639e059b0a0a30daaef64f9251827a912bd2d11c3a0c4c28493b3e004ccd92e9efe6cbcca283b4
7
+ data.tar.gz: c6c2563ed6498dbb4dd6f495d79c4863d2910a6d7a1d3e9480c03d17732cb3ccc8bba248ef4b58fe27a0e81bde50f9392848e697c6d1c0808c851571bca2ee83
data/lib/cratus/user.rb CHANGED
@@ -34,8 +34,24 @@ module Cratus
34
34
  @raw_ldap_data[Cratus.config.user_lockout_attribute].last
35
35
  end
36
36
 
37
+ # https://fossies.org/linux/web2ldap/pylib/w2lapp/schema/plugins/activedirectory.py
38
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/ms676843(v=vs.85).aspx
39
+ #
37
40
  def locked?
38
- lockouttime != '0'
41
+ return false if lockouttime == '0'
42
+ epoch = 116_444_736_000_000_000
43
+ current = Time.now.to_i * 10_000_000
44
+ current - (lockouttime - epoch) < lockoutduration
45
+ end
46
+
47
+ def lockoutduration
48
+ raw_results = Cratus::LDAP.search(
49
+ '(objectClass=domain)',
50
+ basedn: Cratus.config.basedn,
51
+ attrs: 'lockoutDuration',
52
+ scope: 'object'
53
+ ).last
54
+ Integer(raw_results[:lockoutduration].last) * -1
39
55
  end
40
56
 
41
57
  def member_of
@@ -3,7 +3,7 @@ module Cratus
3
3
  def self.version
4
4
  major = 0 # Breaking, incompatible releases
5
5
  minor = 2 # Compatible, but new features
6
- patch = 4 # Fixes to existing features
6
+ patch = 5 # Fixes to existing features
7
7
  [major, minor, patch].map(&:to_s).join('.')
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cratus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-09 00:00:00.000000000 Z
12
+ date: 2016-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize