
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Many web applications required you to log in before being able to interact with them; which poses a real barer of entry for new users. You need users to have accounts for many tasks, but you don't need those accounts to be any more than an id. No username, no password, no profile.
This library is an implementation of that. You add the UbiquitousUser::Usable mixin to your ApplicationController and after that call user to get a current_user. When a new user is saved, it'll automatically store the id in the session[:user_id] in the controller to mark this new user as the logged in user.
When a user logs in what you have to do is set the user, which is just doing
current_user = userObject
The user model and how to authenticate is your responsibility; ubiquity_user doesn't try solve those problem.
Since people just accessing your web site will have a user, people that is already registered at your web site may have an anonymous user with activity in it. You should try to merge it.
ubiquity_user is designed for and tested in Rails 3.X. It wight work on Rails 2.X but it might also require some fixes (which might be welcome). It also works fine with omni_auth.
The canonical places for this gem are:
In your application_controller.rb be sure to add the mixin to ApplicationController, like this:
class ApplicationController < ActionController::Base
include UbiquitousUser::Usable
#...
end
After that you can use user anywhere, for example:
@item.recommender = current_user
or
<%=h current_user.name %>
You can use current_user= in the controllers, for example:
class SessionsController < ApplicationController
def destroy
self.current_user = nil
# ...
end
def create
# ...
self.current_user = user
end
# ...
end
Ubiquitous User expects you to have a model for your users called User (configurable). You could create such a model with the following command:
rails generate model User
If your user model is not called User or the method to create a new one isn't :new, then you can configure Ubiquity User to work with the alternatives:
UbiquitousUser::Config::user_model = :User
UbiquitousUser::Config::user_model_new = :new
Up to date api documentation should be automatically generated on http://rdoc.info/projects/pupeno/ubiquitous_user
Copyright (c) 2009, 2010, 2011 José Pablo Fernández. See LICENSE for details.
FAQs
Unknown package
We found that ubiquitous_user demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.