trustieforge/app/models/gitlab_user.rb

20 lines
414 B
Ruby

class GitlabUser < ActiveRecord::Base
attr_accessible :user_id
belongs_to :user
# 获取用户在Gitlab项目中的角色
def project_role gitlab_project_id
@project_role[gitlab_project_id]
end
def project_role_set(gitlab_project_id,role)
if @project_role.nil?
@project_role = []
end
@project_role[gitlab_project_id] = role
end
validates_uniqueness_of :gitlab_user_id
end