Module: Authorized::Helper

Defined in:
lib/authorized/helper.rb

Instance Method Summary collapse

Instance Method Details

#user_rolesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/authorized/helper.rb', line 4

def user_roles
	s = ''
	if current_user.may_administrate?
		s << "<ul>"
		@roles.each do |role|
			s << "<li>"
			if @user.role_names.include?(role.name)
				s << link_to( "Remove user role of '#{role.name}'", 
					user_role_path(@user,role.name),
					:method => :delete )
			else
				s << link_to( "Assign user role of '#{role.name}'", 
					user_role_path(@user,role.name),
					:method => :put )
			end
			s << "</li>\n"
		end
		s << "</ul>\n"
	end
	s
end