Project

General

Profile

How to get group_id of Current User in redmine

Added by anhkhoa Michel about 10 years ago

Hi all. I want to get group_id of current user And I used: User.current.group.id but This error. Please help me!!!!


Replies (2)

RE: How to get group_id of Current User in redmine - Added by Martin Denizet (redmine.org team member) about 10 years ago

Hi Ankhoa,

A user can actually have several groups.
That's why in order to collect the array of Ids you should use:

User.current.group_ids

Cheers,

RE: How to get group_id of Current User in redmine - Added by Egerton Maciel about 5 years ago

Example use:

isSuporte = false

User.current.group_ids.each do |item|
    if item == 8
      isSuporte = true
    end
end
    (1-2/2)