diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-03-17 17:15:38 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-03-17 17:15:38 +0300 |
commit | 21af7459ab6f3049a98cfdaa6dda8dc2336098d8 (patch) | |
tree | b596f459936c00f12fbdc8e50dcf9febdd80391e /spec/models | |
parent | cf2e3ff6f985c1ffdab9b795d79f792d3ea115fa (diff) | |
parent | 956e914307029dbfbdb387fd6c0749dd50935fa4 (diff) |
Merge branch '4009-external-users' into 'master'
External Users
The user has the rights of a public user execpt it can never create a project, group, or team. Also it cant view internal projects.
Partially fix for both #4009 and #13938 (except the LDAP sync or a pattern to detect external users)
![Screen_Shot_2016-03-14_at_22.02.52](/uploads/486a84ab3acb98c6cfb71a4ec7d268e2/Screen_Shot_2016-03-14_at_22.02.52.png)
See merge request !3171
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6290ab3ebec..0ab7fd88ce6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -180,6 +180,20 @@ describe User, models: true do it { is_expected.to respond_to(:is_admin?) } it { is_expected.to respond_to(:name) } it { is_expected.to respond_to(:private_token) } + it { is_expected.to respond_to(:external?) } + end + + describe 'before save hook' do + context 'when saving an external user' do + let(:user) { create(:user) } + let(:external_user) { create(:user, external: true) } + + it "sets other properties aswell" do + expect(external_user.can_create_team).to be_falsey + expect(external_user.can_create_group).to be_falsey + expect(external_user.projects_limit).to be 0 + end + end end describe '#confirm' do @@ -404,6 +418,7 @@ describe User, models: true do expect(user.projects_limit).to eq(Gitlab.config.gitlab.default_projects_limit) expect(user.can_create_group).to eq(Gitlab.config.gitlab.default_can_create_group) expect(user.theme_id).to eq(Gitlab.config.gitlab.default_theme) + expect(user.external).to be_falsey end end |