Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authoring Posts plugin shows all users instead of current_site.users #681

Closed
pbr-pl opened this issue Aug 24, 2017 · 1 comment
Closed

Comments

@pbr-pl
Copy link

pbr-pl commented Aug 24, 2017

When you have users_share_sites set to false Authoring Posts plugin shows all users instead of current_site.users
The reason is that current_site.users collection is not the same as current_site.users.unscoped collection

My fast solution is to change plugin_authoring_authors_list in camaleon-cms/app/apps/plugins/authoring_post/authoring_post_helper.rb

def plugin_authoring_authors_list(post)
    author_id = post.new_record? ? current_user.id : post.author.id
    ret = ''
    if PluginRoutes.system_info["users_share_sites"]
      current_site.users.unscoped.where('role <> ?', 'client').order(:username).each do |user|
        ret += "<option value='#{user.id}' #{user.id.eql?(author_id) ? 'selected' : ''}>#{user.username.titleize}#{user.fullname.eql?(user.username.titleize) ? '' : ' (' +  user.fullname + ')' }</option>"
      end
    else
      CamaleonCms::User.unscoped.where('role <> ? and site_id = ?', 'client', current_site.id).order(:username).each do |user|
        ret += "<option value='#{user.id}' #{user.id.eql?(author_id) ? 'selected' : ''}>#{user.username.titleize}#{user.fullname.eql?(user.username.titleize) ? '' : ' (' +  user.fullname + ')' }</option>"
      end
    end
    ret
  end
@owen2345
Copy link
Owner

You are right!
I don't remember why '. unscoped' was added (solved by removing it).
Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants