Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Disable an user
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Suec  
View profile  
 More options Jun 1 2009, 9:37 pm
From: Suec <sueche...@gmail.com>
Date: Mon, 1 Jun 2009 18:37:30 -0700 (PDT)
Local: Mon, Jun 1 2009 9:37 pm
Subject: Disable an user
What is the best way to disable an user(or disable his/her login)?

Thanks,


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
scott  
View profile  
 More options Jun 1 2009, 11:42 pm
From: scott <scot...@gmail.com>
Date: Mon, 1 Jun 2009 20:42:23 -0700 (PDT)
Local: Mon, Jun 1 2009 11:42 pm
Subject: Re: Disable an user
Authlogic::Session::MagicStates - Automatically validates based on the
records states: active?, approved?, and confirmed?. If those methods
exist for the record.
just create a active? method in your user model.

one easy way is to create a boolean column in your user table named
something like active and put this in your user model

def active?
  self.active
end

if active? returns true, they can login, if it returns false, they
will be blocked from logging in.

On Jun 1, 9:37 pm, Suec <sueche...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Johnson  
View profile  
 More options Jun 1 2009, 11:46 pm
From: Ben Johnson <bjohn...@binarylogic.com>
Date: Mon, 1 Jun 2009 23:46:36 -0400
Local: Mon, Jun 1 2009 11:46 pm
Subject: Re: Disable an user
Yep, scott has it right. Also, I am pretty sure if you create a  
boolean column you get the ? method for free.

Lastly, you can stop the login writing your own validation hook, just  
like you would for an AR model. So fi you don't want to use active?  
you can define your own method and do whatever you want:

validate :login_disabled

Ben Johnson
Binary Logic

W: www.binarylogic.com
E: bjohn...@binarylogic.com

1430 Broadway
7th Floor - NECO
New York, NY 10018

On Jun 1, 2009, at 11:42 PM, scott wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Suec  
View profile  
 More options Jun 2 2009, 3:09 am
From: Suec <sueche...@gmail.com>
Date: Tue, 2 Jun 2009 00:09:28 -0700 (PDT)
Local: Tues, Jun 2 2009 3:09 am
Subject: Re: Disable an user
Thanks a lot, works really well.

Sue

On Jun 1, 8:46 pm, Ben Johnson <bjohn...@binarylogic.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pixelhandler  
View profile  
 More options Jun 26 2009, 1:58 am
From: pixelhandler <pixelhand...@gmail.com>
Date: Thu, 25 Jun 2009 22:58:04 -0700 (PDT)
Local: Fri, Jun 26 2009 1:58 am
Subject: Re: Disable an user
I create an action based on my login id....

in the user controller...

# GET /users/ban/1
  def ban
    @user = User.find(params[:id])
    if superuser == true
      @user.update_attribute(:confirmed,0)
      flash[:notice] = "{...@user.login} was banned"
    else
      flash[:notice] = "huh?"
    end
    respond_to do |format|
      format.html { redirect_to(users_path) }
      format.xml  { head :ok }
    end
  end

You will also need to define the superuser ; I did this as a private
function ...

def superuser
      unless @current_user.id == 1
        return false
      end
      return true
    end

Note 1 is the first record in the users table

On Jun 1, 6:37 pm, Suec <sueche...@gmail.com> wrote:


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google