-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.rb
More file actions
37 lines (22 loc) · 914 Bytes
/
plugin.rb
File metadata and controls
37 lines (22 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# name: groups sync
# about: A Discourse plugin that allows to sync discourse groups with ldap groups.
# version: 0.1.1
# authors : Cyrine Gamoudi <syrynegamoudi@gmail.com>
enabled_site_setting :groups_sync_enabled
gem 'net-ldap', '0.16.2'
after_initialize do
require_relative 'app/jobs/scheduled/groups_sync_job'
#creating the custom fields, group_sync and ldap_dn for groups
Group.register_custom_field_type('group_sync', :boolean)
Group.preload_custom_fields<< "group_sync" if
Group.respond_to? :preloaded_custom_fields
Group.register_custom_field_type('ldap_dn', :text)
Group.preload_custom_fields<< "ldap_dn" if
Group.respond_to? :preloaded_custom_fields
register_editable_group_custom_field [:group_sync, :ldap_dn];
if SiteSetting.groups_sync_enabled then
add_to_serializer(:group_show, :custom_fields, false) {
object.custom_fields
}
end
end