GRN2-176: Create a role editor that allows admins to specify what permissions each role has (#709)

* Add roles editor

* Add colour selection ability to roles

* Add ability to assign roles to users in the UI

* Remove rolify and replace it with our own custom roles implemenation

* - Fix all existing roles functionality
- Fix super admins

* Fix bugs with new customers not have default roles

* Add can't create room setting

* Code improvements

* Fix migration

* Add tests for new methods

* Translate reserved role names

* Pull roles from saml/ldap

* Fix rspec

* Fix scrutinizer issues

* Fix email promoted/demoted tests

* Apply comments

* Redirect directly to the main room

* Add comments
This commit is contained in:
shawn-higgins1
2019-07-31 11:53:32 -04:00
committed by Jesus Federico
parent 02b342b157
commit 4fc1714db8
56 changed files with 1713 additions and 328 deletions

View File

@ -61,6 +61,19 @@ describe RoomsController, type: :controller do
expect(response).to render_template(:join)
end
it "should render cant_create_rooms if user doesn't have permission to create rooms" do
user_role = @user.highest_priority_role
user_role.can_create_rooms = false
user_role.save!
@request.session[:user_id] = @user.id
get :show, params: { room_uid: @user.main_room }
expect(response).to render_template(:cant_create_rooms)
end
it "should be able to search public recordings if user is not owner" do
@request.session[:user_id] = @user.id
@ -454,4 +467,32 @@ describe RoomsController, type: :controller do
expect(flash[:alert]).to eq(I18n.t("room.access_code_required"))
end
end
describe "POST join_specific_room" do
before do
@user = create(:user)
@user1 = create(:user)
end
it "should display flash if the user doesn't supply a valid uid" do
@request.session[:user_id] = @user.id
post :join_specific_room, params: { join_room: { url: "abc" } }
expect(flash[:alert]).to eq(I18n.t("room.no_room.invalid_room_uid"))
expect(response).to redirect_to room_path(@user.main_room)
end
it "should redirect the user to the room uid they supplied" do
post :join_specific_room, params: { join_room: { url: @user1.main_room } }
expect(response).to redirect_to room_path(@user1.main_room)
end
it "should redirect the user to the room join url they supplied" do
post :join_specific_room, params: { join_room: { url: room_path(@user1.main_room) } }
expect(response).to redirect_to room_path(@user1.main_room)
end
end
end