onelogin 1.4.1 → 1.5.0

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: 64e6e29b56b12199b47d96a82fabf486272796c0
4
- data.tar.gz: e58d0fc1beedc5f6b3d8a27de797efd35219ca66
3
+ metadata.gz: b88c409d8f894444cea2c417d3cef961263c063d
4
+ data.tar.gz: b737ed1099a19e1d5bb7e21f5535a02e9058791b
5
5
  SHA512:
6
- metadata.gz: 7c9efa8534a4b3cf216331b9354a1a00092c0e269f48d2709b23a792b91c0024fa4301ff1748dd9edacf542e6329d870bb0e37a07cd34c294a7a376860bb172f
7
- data.tar.gz: a920aac7680480a2e74688e472807ee4056b52ff03949c50d70f0295f16c1c099450349c7cb268c99fabf71404e48174fd750b2f17d9fde385c0e0663b00d021
6
+ metadata.gz: 21fa7556a20c6f0d851fe9b7bb92a9311aac2892fca42a73baf78135ec88c8f5ad249466a0f82330015cf34b488f9f2cdc149010a2a4492af9c9db308bfc9c3a
7
+ data.tar.gz: adef4c496b683e629f344fe2e771c79d6472e0db87b5bba65268e33c6f53f5dc36d6757c73172bfb1d5ca7de20430b3919616ed87fa0b81c49bc63310f7ebc7b
data/README.md CHANGED
@@ -238,6 +238,9 @@ role_ids = client.get_user_roles(user.id)
238
238
  # Generate MFA Token
239
239
  mfa_token = client.generate_mfa_token(user.id)
240
240
 
241
+ # Get all Apps in a OneLogin account */
242
+ apps = client.get_apps
243
+
241
244
  # Create user
242
245
  new_user_params = {
243
246
  email: "testcreate_1@example.com",
@@ -105,9 +105,13 @@ class UsersController < ApplicationController
105
105
 
106
106
  private
107
107
 
108
+ def set_user
109
+ @user = api_client.get_user(params[:id])
110
+ end
111
+
108
112
  # Never trust parameters from the scary internet, only allow the white list through.
109
113
  def user_params
110
- params.permit(:firstname, :lastname, :email, :phone, :custom_field, :username, :password)
114
+ params.permit(:firstname, :lastname, :email, :phone, :username, :password)
111
115
  end
112
116
 
113
117
  def custom_user_params
@@ -1,27 +1,33 @@
1
- <h1>Editing User</h1>
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-sm">
4
+ <p><%= link_to 'Back', users_path %></p>
2
5
 
3
- <%= form_tag update_user_path, method: "patch", class: "edit" do %>
6
+ <h2>Edit User</h2>
4
7
 
5
- <div>
6
- First Name: <input type="text" name="firstname" value="<%= @user.firstname%>">
8
+ <%= form_tag update_user_path, method: "patch", class: "edit" do %>
9
+ <div class="form-group">
10
+ <label for="firstname">First Name</label>
11
+ <input type="text" name="firstname" value="<%= @user.firstname%>" class="form-control">
12
+ </div>
13
+ <div class="form-group">
14
+ <label for="lastname">Last Name</label>
15
+ <input type="text" name="lastname" value="<%= @user.lastname%>" class="form-control">
16
+ </div>
17
+ <div class="form-group">
18
+ <label for="email">Email</label>
19
+ <input type="text" name="email" value="<%= @user.email%>" class="form-control">
20
+ </div>
21
+ <div class="form-group">
22
+ <label for="email">Phone</label>
23
+ <input type="text" name="phone" value="<%= @user.phone%>" class="form-control">
24
+ </div>
25
+ <div class="form-group">
26
+ <label for="email">Custom Field</label>
27
+ <input type="text" name="custom_field" value="<%= @user.custom_attributes['custom_field'] if @user.custom_attributes.present? %>" class="form-control">
28
+ </div>
29
+ <button type="submit" class="btn btn-primary">Save</button>
30
+ <% end %>
31
+ </div>
7
32
  </div>
8
- <div>
9
- Last Name: <input type="text" name="lastname" value="<%= @user.lastname%>">
10
- </div>
11
- <div>
12
- Email: <input type="text" name="email" value="<%= @user.email%>">
13
- </div>
14
- <div>
15
- Phone: <input type="text" name="phone" value="<%= @user.phone%>">
16
- </div>
17
- </div>
18
- <div>
19
- Custom Field: <input type="text" name="custom_field" value="<%= @user.custom_attributes['custom_field']%>">
20
- </div>
21
-
22
- <div class="actions">
23
- <%= submit_tag %>
24
- </div>
25
- <% end %>
26
-
27
- <%= link_to 'Back', users_path %>
33
+ </div>
@@ -1,30 +1,33 @@
1
1
  <p id="notice"><%= notice %></p>
2
2
 
3
- <h1>Users</h1>
3
+ <div class="container">
4
+ <div class="row">
5
+ <div class="col-sm">
6
+ <h2>Users</h2>
7
+ <table class="table">
8
+ <thead>
9
+ <tr>
10
+ <th scope="col">Name</th>
11
+ <th scope="col">Email</th>
12
+ <th scope="col">Phone</th>
13
+ <th scope="col">Custom Field</th>
14
+ <th scope="col" colspan="2"></th>
15
+ </tr>
16
+ </thead>
4
17
 
5
- <table class="table">
6
- <thead>
7
- <tr>
8
- <th scope="col">Name</th>
9
- <th scope="col">Email</th>
10
- <th scope="col">Phone</th>
11
- <th scope="col">Custom Field</th>
12
- <th scope="col" colspan="2"></th>
13
- </tr>
14
- </thead>
15
-
16
- <tbody>
17
- <% @users.each do |user| %>
18
- <tr>
19
- <td scope="row"><%= user.firstname %> <%= user.lastname %></td>
20
- <td><%= user.email %></td>
21
- <td><%= user.phone %></td>
22
- <td><%= user.custom_attributes["custom_field"] if user.custom_attributes.is_a?(Hash) %></td>
23
- <td><%= link_to 'Show', user_path(user.id) %></td>
24
- <td><%= link_to 'Edit', edit_user_path(user.id) %></td>
25
- </tr>
26
- <% end %>
27
- </tbody>
28
- </table>
29
-
30
- <br>
18
+ <tbody>
19
+ <% @users.each do |user| %>
20
+ <tr>
21
+ <td scope="row"><%= user.firstname %> <%= user.lastname %></td>
22
+ <td><%= user.email %></td>
23
+ <td><%= user.phone %></td>
24
+ <td><%= user.custom_attributes["custom_field"] if user.custom_attributes.is_a?(Hash) %></td>
25
+ <td><%= link_to 'Show', user_path(user.id) %></td>
26
+ <td><%= link_to 'Edit', edit_user_path(user.id) %></td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+ </div>
33
+ </div>
@@ -1,14 +1,17 @@
1
- <p id="notice"><%= notice %></p>
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-sm">
4
+ <%= link_to 'Edit', edit_user_path(@user.id) %> |
5
+ <%= link_to 'Back', users_path %>
2
6
 
3
- <%= link_to 'Edit', edit_user_path(@user.id) %> |
4
- <%= link_to 'Back', users_path %>
5
-
6
- <h2>Profile</h2>
7
-
8
- <ul class="list-group">
9
- <%@user.instance_values.symbolize_keys.each do |k, v|%>
10
- <li class="list-group-item">
11
- <b><%= k%>:</b> <%= v%>
12
- </li>
13
- <%end%>
14
- </ul>
7
+ <h2><%= @user.firstname %> <%= @user.lastname %></h2>
8
+ <ul class="list-group">
9
+ <%@user.instance_values.symbolize_keys.each do |k, v|%>
10
+ <li class="list-group-item">
11
+ <b><%= k%>:</b> <%= v%>
12
+ </li>
13
+ <%end%>
14
+ </ul>
15
+ </div>
16
+ </div>
17
+ </div>
@@ -1089,6 +1089,40 @@ module OneLogin
1089
1089
  end
1090
1090
 
1091
1091
 
1092
+ #########################
1093
+ # Onelogin Apps Methods #
1094
+ #########################
1095
+
1096
+ # Gets a list of OneLoginApp resources. (if no limit provided, by default get 50 elements)
1097
+ #
1098
+ # @param params [Hash] Parameters to filter the result of the list
1099
+ #
1100
+ # @return [Array] list of OneLoginApp objects
1101
+ #
1102
+ # @see {https://developers.onelogin.com/api-docs/1/apps/get-apps Get Apps documentation}
1103
+ def get_apps(params = {})
1104
+ clean_error
1105
+ prepare_token
1106
+
1107
+ begin
1108
+ options = {
1109
+ model: OneLogin::Api::Models::OneLoginApp,
1110
+ headers: authorized_headers,
1111
+ max_results: @max_results,
1112
+ params: params
1113
+ }
1114
+
1115
+ return Cursor.new(self.class, url_for(GET_APPS_URL), options)
1116
+
1117
+ rescue Exception => e
1118
+ @error = '500'
1119
+ @error_description = e.message
1120
+ end
1121
+
1122
+ nil
1123
+ end
1124
+
1125
+
1092
1126
  ################
1093
1127
  # Role Methods #
1094
1128
  ################
@@ -7,6 +7,7 @@ require 'onelogin/api/models/factor_enrollment_response'
7
7
  require 'onelogin/api/models/group'
8
8
  require 'onelogin/api/models/mfa'
9
9
  require 'onelogin/api/models/mfa_token'
10
+ require 'onelogin/api/models/onelogin_app'
10
11
  require 'onelogin/api/models/onelogin_token'
11
12
  require 'onelogin/api/models/otp_device'
12
13
  require 'onelogin/api/models/privilege'
@@ -0,0 +1,22 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class OneLoginApp
6
+
7
+ attr_accessor :id, :connector_id, :name, :extension
8
+ attr_accessor :icon, :visible, :provisioning
9
+
10
+ def initialize(data)
11
+ @id = data['id']
12
+ @connector_id = data['connector_id']
13
+ @name = data['name']
14
+ @extension = data['extension']
15
+ @icon = data['icon']
16
+ @visible = data['visible']
17
+ @provisioning = data['provisioning']
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -34,6 +34,9 @@ module OneLogin
34
34
  LOCK_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s/lock_user"
35
35
  GENERATE_MFA_TOKEN_URL = "https://api.%s.onelogin.com/api/1/users/%s/mfa_token"
36
36
 
37
+ # Apps URL
38
+ GET_APPS_URL = "https://api.%s.onelogin.com/api/1/apps"
39
+
37
40
  # Role URLs
38
41
  GET_ROLES_URL = "https://api.%s.onelogin.com/api/1/roles"
39
42
  CREATE_ROLE_URL = "https://api.%s.onelogin.com/api/1/roles"
@@ -1,3 +1,3 @@
1
1
  module OneLogin
2
- VERSION = "1.4.1"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onelogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OneLogin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-01 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -228,6 +228,7 @@ files:
228
228
  - lib/onelogin/api/models/group.rb
229
229
  - lib/onelogin/api/models/mfa.rb
230
230
  - lib/onelogin/api/models/mfa_token.rb
231
+ - lib/onelogin/api/models/onelogin_app.rb
231
232
  - lib/onelogin/api/models/onelogin_token.rb
232
233
  - lib/onelogin/api/models/otp_device.rb
233
234
  - lib/onelogin/api/models/privilege.rb