roadrecon 1.4.0__py3-none-any.whl → 1.6.0__py3-none-any.whl

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.
@@ -25,6 +25,7 @@ from roadtools.roadlib.metadef.database import (
25
25
  from sqlalchemy import bindparam, func, text
26
26
  from sqlalchemy.dialects.postgresql import insert as pginsert
27
27
  from sqlalchemy.orm import sessionmaker
28
+ from datetime import datetime
28
29
 
29
30
  warnings.simplefilter('ignore')
30
31
  token = None
@@ -124,11 +125,14 @@ def checktoken():
124
125
  auth.tokendata = token
125
126
  if 'useragent' in token:
126
127
  auth.set_user_agent(token['useragent'])
128
+ if 'originheader' in token:
129
+ auth.set_origin_value(token['originheader'])
127
130
  if 'refreshToken' in token:
131
+ print("- Attempting token refresh -")
128
132
  token = auth.authenticate_with_refresh(token)
129
133
  headers['Authorization'] = '%s %s' % (token['tokenType'], token['accessToken'])
130
134
  expiretime = time.time() + token['expiresIn']
131
- print('Refreshed token')
135
+ print('+ Refreshed token +')
132
136
  return True
133
137
  elif time.time() > expiretime:
134
138
  print('Access token is expired, but no access to refresh token! Dumping will fail')
@@ -587,7 +587,7 @@ class AccessPoliciesPlugin():
587
587
  loc['name'] = escape(detail.get("NetworkName"))
588
588
  loc['trusted'] = ("trusted" in detail.get("Categories","") if detail.get("Categories") else False)
589
589
  loc['appliestounknowncountry'] = escape(str(detail.get("ApplyToUnknownCountry"))) if detail.get("ApplyToUnknownCountry") is not None else False
590
- loc['ipranges'] = "\n<br />".join(detail.get('CidrIpRanges'))
590
+ loc['ipranges'] = "\n<br />".join(detail.get('CidrIpRanges')) if detail.get("CidrIpRanges") else ""
591
591
  loc['categories'] = escape(", ".join(detail.get("Categories"))) if detail.get("Categories") is not None else ""
592
592
  loc['associated_policies'] = "\n<br />".join(self._parse_associated_polcies(detail.get('NetworkId'),loc['trusted'],condition_policy_list))
593
593
  loc['country_codes'] = escape(", ".join(detail.get("CountryIsoCodes"))) if detail.get("CountryIsoCodes") else None
@@ -41,7 +41,7 @@ class RTModelSchema(ma.SQLAlchemyAutoSchema):
41
41
  class UsersSchema(ma.Schema):
42
42
  class Meta:
43
43
  model = User
44
- fields = ('objectId', 'objectType', 'userPrincipalName', 'displayName', 'mail', 'lastDirSyncTime', 'accountEnabled', 'department', 'lastPasswordChangeDateTime', 'jobTitle', 'mobile', 'dirSyncEnabled', 'strongAuthenticationDetail', 'userType')
44
+ fields = ('objectId', 'objectType', 'userPrincipalName', 'displayName', 'mail', 'lastDirSyncTime', 'accountEnabled', 'department', 'lastPasswordChangeDateTime', 'jobTitle', 'mobile', 'dirSyncEnabled', 'strongAuthenticationDetail', 'userType', 'searchableDeviceKey')
45
45
 
46
46
  class DevicesSchema(ma.Schema):
47
47
  class Meta:
@@ -157,6 +157,10 @@ class TenantDetailSchema(RTModelSchema):
157
157
  class Meta(RTModelSchema.Meta):
158
158
  model = TenantDetail
159
159
 
160
+ class DirectorySettingSchema(RTModelSchema):
161
+ class Meta(RTModelSchema.Meta):
162
+ model = DirectorySetting
163
+
160
164
  class AuthorizationPolicySchema(RTModelSchema):
161
165
  class Meta(RTModelSchema.Meta):
162
166
  model = AuthorizationPolicy
@@ -167,6 +171,7 @@ device_schema = DeviceSchema()
167
171
  group_schema = GroupSchema()
168
172
  application_schema = ApplicationSchema()
169
173
  td_schema = TenantDetailSchema()
174
+ ds_schema = DirectorySettingSchema()
170
175
  serviceprincipal_schema = ServicePrincipalSchema()
171
176
  administrativeunit_schema = AdministrativeUnitSchema()
172
177
  authorizationpolicy_schema = AuthorizationPolicySchema(many=True)
@@ -318,7 +323,8 @@ def get_mfa():
318
323
  'has_app': has_app,
319
324
  'has_phonenr': has_phonenr,
320
325
  'has_fido': has_fido,
321
- 'strongAuthenticationDetail': user.strongAuthenticationDetail
326
+ 'strongAuthenticationDetail': user.strongAuthenticationDetail,
327
+ 'searchableDeviceKey': user.searchableDeviceKey
322
328
  })
323
329
  return jsonify(out)
324
330
 
@@ -529,6 +535,11 @@ def get_tenantdetails():
529
535
  drs = db.session.query(TenantDetail).first()
530
536
  return td_schema.jsonify(drs)
531
537
 
538
+ @app.route("/api/directorysettings", methods=["GET"])
539
+ def get_directorysettings():
540
+ drs = db.session.query(DirectorySetting).first()
541
+ return ds_schema.jsonify(drs)
542
+
532
543
  @app.route("/api/authorizationpolicies", methods=["GET"])
533
544
  def get_authpolicies():
534
545
  drs = db.session.query(AuthorizationPolicy).all()