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

Add ability to restrict users to specific languages #2458

Closed
wants to merge 1 commit into from

Conversation

dbwinger
Copy link
Contributor

What is this pull request for?

Add a feature to enable restricting CMS users to specific languages. This applies to Site, Language, Page, and Node CMS functionality. This integrates with user roles to provide additional restrictions when used. Another PR to alchemy-devise will add additional functionality and UI specific to that Alchemy User implementation.

User of this feature is optional and does not break any existing functionality.

Screenshots

See forthcoming alchemy-devise PR.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
@dbwinger
Copy link
Contributor Author

NOTE: This is working, but looking for feedback on implementation before finalizing and filling out test suite. If manually testing, you'll need to add languages to the user in the Rails console, like

$ DummyUser.last.update alchemy_languages: [Alchemy::Language.last]

end

it "cannot manage a language they do not have access to" do
user = create(:alchemy_dummy_user, :as_editor, languages: create_list(:alchemy_language, 1, :german))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - user.

spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
spec/libraries/permissions_spec.rb Outdated Show resolved Hide resolved
@@ -177,6 +252,24 @@
it "can manage tags" do
is_expected.to be_able_to(:manage, Alchemy::Tag)
end

it "can index languages in sites they can access" do
user = create(:alchemy_dummy_user, :as_editor, languages: create_list(:alchemy_language, 1, :german))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - user.

@dbwinger dbwinger force-pushed the user-languages branch 3 times, most recently from b083ff9 to b6f456a Compare April 19, 2023 16:01
@dbwinger
Copy link
Contributor Author

dbwinger commented Jun 5, 2023

FYI, @tvdeyen I'm waiting for feedback from you or others on the implementation of this before I finish it off.

@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added the Stale label Aug 5, 2023
@dbwinger
Copy link
Contributor Author

dbwinger commented Aug 7, 2023

@tvdeyen @mamhoff Sorry to tag you guys if that's annoying. This is available for preliminary review. If you're not interested in the feature, no problem. I just thought it might be useful but wanted a little input before finishing everything up.

@github-actions github-actions bot removed the Stale label Aug 8, 2023
Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added the Stale label Nov 29, 2023
Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
This PR will be closed in 7 days if no further activity happens.

@github-actions github-actions bot added the Stale label Apr 20, 2024
Copy link

This pull request has not seen any activiy in a long time.
Probably because of missing tests or a necessary rebase.
Please open a new PR to latest main if you want to continue working on this.
Thanks for the contribution.

@github-actions github-actions bot closed this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant