Using Roles but don´t want to show them

Hi everyone,

i am using roles in my project for admin and author and so on... This is my code "   ROLES = %w[admin moderator author]

  def roles=(roles)     self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.sum   end

  def roles     ROLES.reject { |r| ((roles_mask || 0) & 2**ROLES.index(r)).zero? }   end

  def role?(role)     roles.include? role.to_s   end end "

But if somebody wants to sign in he can choose between admin, moderator, author by himself. He has to be automatically author. Is there a way to fix that problem?

Thanks

But if somebody wants to sign in he can choose between admin, moderator, author by himself. He has to be automatically author. Is there a way to fix that problem?

Don't put a role popup on the form ? ( & disallow mass assignment for the attribute)

Fred

Thank you for your answer but i don't understand what you mean. I don't have a popup on the form.

In my view there are in the sign in form the three checkboxes

admin moderator author

So there you can choose what function you want to have. But no one else has to be admin. Everybody has to be author. So I just want du show one checkbox "author". But i can not delete admin and moderator because my admin account hasn't got the admin functions if i delete it. You know what i mean?

So i just want to fade out the other oppertunities.

Thanks very much

Thank you for your answer but i don't understand what you mean. I don't have a popup on the form.

In my view there are in the sign in form the three checkboxes

admin moderator author

So there you can choose what function you want to have. But no one else has to be admin. Everybody has to be author. So I just want du show one checkbox "author". But i can not delete admin and moderator because my admin account hasn't got the admin functions if i delete it. You know what i mean?

So i just want to fade out the other oppertunities.

Could you not top post please, it is easier to follow the thread if comments are inserted into the previous email. Thanks

Why not just do not put the options on the sign in form? If it always has to be author there is no need to put it on the form at all. This does not mean that you have to do away with the roles, just do not give the option to set it on the signup form. Presumably you have an alternative method of setting up admin and moderator roles.

Colin