Remove user from all projects and set blocked attribute to true
# File app/roles/account.rb, line 47 def block users_projects.find_each do |membership| return false unless membership.destroy end self.blocked = true save end
# File app/roles/account.rb, line 25 def can_create_group? is_admin? end
# File app/roles/account.rb, line 21 def can_create_project? projects_limit > my_own_projects.count end
# File app/roles/account.rb, line 37 def cared_merge_requests MergeRequest.where("author_id = :id or assignee_id = :id", id: self.id).opened end
# File app/roles/account.rb, line 33 def first_name name.split.first unless name.blank? end
Returns a string for use as a Gitolite user identifier
Note that Gitolite 2.x requires the following pattern for users:
^@?[0-9a-zA-Z][0-9a-zA-Z._\@+-]*$
# File app/roles/account.rb, line 7 def identifier # Replace non-word chars with underscores, then make sure it starts with # valid chars email.gsub(%r\W/, '_').gsub(%r\A([\W\_])+/, '') end
# File app/roles/account.rb, line 13 def is_admin? admin end
# File app/roles/account.rb, line 29 def last_activity_project projects.first end
# File app/roles/account.rb, line 41 def project_ids projects.map(&:id) end
# File app/roles/account.rb, line 56 def projects_limit_percent return 100 if projects_limit.zero? (my_own_projects.count.to_f / projects_limit) * 100 end
# File app/roles/account.rb, line 70 def projects_with_events projects.includes(:events).order("events.created_at DESC") end
# File app/roles/account.rb, line 61 def recent_push project_id = nil # Get push events not earlier than 2 hours ago events = recent_events.code_push.where("created_at > ?", Time.now - 2.hours) events = events.where(project_id: project_id) if project_id # Take only latest one events = events.recent.limit(1).first end
# File app/roles/account.rb, line 17 def require_ssh_key? keys.count == 0 end