This commit is contained in:
Wenkai Yin 2016-06-14 17:33:37 +08:00
parent fcfa009cad
commit db9347135c
4 changed files with 6 additions and 4 deletions

View File

@ -77,7 +77,7 @@ func (p *ProjectAPI) Post() {
err := validateProjectReq(req)
if err != nil {
log.Errorf("Invalid project request, error: %v", err)
p.RenderError(http.StatusBadRequest, "Invalid request for creating project")
p.RenderError(http.StatusBadRequest, fmt.Sprintf("invalid request: %v", err))
return
}
projectName := req.ProjectName

View File

@ -139,7 +139,7 @@ func (pa *RepPolicyAPI) Put() {
pa.CustomAbort(http.StatusNotFound, http.StatusText(http.StatusNotFound))
}
var policy *models.RepPolicy
policy := &models.RepPolicy{}
pa.DecodeJSONReq(policy)
policy.ProjectID = originalPolicy.ProjectID
policy.TargetID = originalPolicy.TargetID

View File

@ -58,7 +58,7 @@ func DeleteProjectMember(projectID int64, userID int) error {
func GetUserByProject(projectID int64, queryUser models.User) ([]models.User, error) {
o := GetOrmer()
u := []models.User{}
sql := `select u.user_id, u.username, r.name rolename, r.role_id
sql := `select u.user_id, u.username, r.name rolename, r.role_id as role
from user u
join project_member pm
on pm.project_id = ? and u.user_id = pm.user_id

View File

@ -29,7 +29,9 @@ type User struct {
Comment string `orm:"column(comment)" json:"comment"`
Deleted int `orm:"column(deleted)" json:"deleted"`
Rolename string `json:"role_name"`
RoleID int `json:"role_id"`
//if this field is named as "RoleID", beego orm can not map role_id
//to it.
Role int `json:"role_id"`
// RoleList []Role `json:"role_list"`
HasAdminRole int `orm:"column(sysadmin_flag)" json:"has_admin_role"`
ResetUUID string `orm:"column(reset_uuid)" json:"reset_uuid"`