chrodriguez / redmine_omniauth_saml

Plugins that adds SAML authentication support for "Redmine"
GNU General Public License v2.0
38 stars 57 forks source link

Group synchronization #7

Closed Marlinc closed 8 years ago

Marlinc commented 8 years ago

Is it possible to some how do group synchronization for users. We're currently using LDAP with the https://github.com/thorin/redmine_ldap_sync plugin.

chrodriguez commented 8 years ago

Hi @Marlinc! As you can see in https://github.com/chrodriguez/redmine_omniauth_saml/blob/master/sample-saml-initializers.rb

there is a block yo can write with your own code after login so you can manage group synchronization.

For example:

 config.on_login do |omniauth_hash, user|
    groups = get_groups_from_omniauth user, omniauth_hash
    groups.each do |group|
    unless User.in_group(group).find_by(id: user.id)
      user.groups <<  group
    end