discourse-scim/plugin.rb

54 lines
1.4 KiB
Ruby
Raw Normal View History

2024-10-06 17:39:16 +00:00
# frozen_string_literal: true
2024-10-09 11:26:05 +00:00
# name: discourse-scim
2024-10-06 17:39:16 +00:00
# about: A plugin to add SCIM endpoints to discourse
# version: 0.0.1
# authors: Peter Bouda
2024-10-09 11:26:05 +00:00
# url: https://forge.libre.sh/libre.sh/discourse-scim
2024-10-06 17:39:16 +00:00
gem "marcel", "1.0.0", { require: false }
gem "activestorage", "7.1.4.1", { require: false }
gem "actiontext", "7.1.4.1", { require: false }
gem "actionmailbox", "7.1.4.1", { require: false }
gem "websocket-extensions", "0.1.0", { require: false }
gem "websocket-driver", "0.6.1", { require: false }
gem "actioncable", "7.1.4.1", { require: false }
gem "rails", "7.1.4.1", { require: false }
gem "scimitar", "2.10.0", { require: false }
2024-10-06 17:39:16 +00:00
require "scimitar"
2024-10-08 07:42:35 +00:00
enabled_site_setting :scim_enabled
add_api_key_scope(
:scim,
{
access_scim_endpoints: {
actions: %w[scim_v2/users#index scim_v2/users#show scim_v2/users#create
scim_v2/users#replace scim_v2/users#update scim_v2/users#destroy
scim_v2/groups#index scim_v2/groups#show scim_v2/groups#create
scim_v2/groups#update],
},
},
)
2024-10-09 11:26:05 +00:00
module ::DiscourseScim
2024-10-31 12:42:55 +00:00
PLUGIN_NAME = "discourse-scim"
2024-10-06 17:39:16 +00:00
2024-10-09 11:26:05 +00:00
require_relative "lib/discourse_scim/engine"
require_relative "lib/discourse_scim/user_mixin"
require_relative "lib/discourse_scim/group_mixin"
2024-10-07 10:22:23 +00:00
end
after_initialize do
class ::User
include DiscourseScim::UserMixin
2024-10-08 07:42:35 +00:00
include Scimitar::Resources::Mixin
end
2024-10-07 10:22:23 +00:00
class ::Group
include DiscourseScim::GroupMixin
2024-10-07 10:22:23 +00:00
include Scimitar::Resources::Mixin
end
2024-10-10 08:28:13 +00:00
end