mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-31 07:55:06 +01:00 
			
		
		
		
	Add support role to tag count
- works equal to admin
This commit is contained in:
		| @@ -82,7 +82,7 @@ func (r *JobRepository) CountTags(user *string, project *string) (tags []schema. | ||||
| 		q = q.Where("jt.job_id IN (SELECT id FROM job WHERE job.user = ?)", *user) | ||||
| 	} else if (user != nil && project != nil) { // MANAGER: Count own jobs plus project's jobs | ||||
| 		q = q.Where("jt.job_id IN (SELECT id FROM job WHERE job.user = ? OR job.project = ?)", *user, *project) | ||||
| 	} // else: ADMIN: Count all jobs | ||||
| 	} // else: ADMIN || SUPPORT: Count all jobs | ||||
|  | ||||
| 	rows, err := q.RunWith(r.stmtCache).Query() | ||||
| 	if err != nil { | ||||
|   | ||||
| @@ -149,12 +149,12 @@ func setupTaglistRoute(i InfoType, r *http.Request) InfoType { | ||||
| 	jobRepo := repository.GetJobRepository() | ||||
| 	user 		:= auth.GetUser(r.Context()) | ||||
|  | ||||
| 	if (user != nil && user.HasNotRoles([]string{auth.RoleAdmin, auth.RoleManager})) { | ||||
| 	if (user != nil && user.HasNotRoles([]string{auth.RoleAdmin, auth.RoleSupport, auth.RoleManager})) { | ||||
| 		username = &user.Username | ||||
| 	} else if (user != nil && user.HasRole(auth.RoleManager)) { | ||||
| 		username = &user.Username | ||||
| 		project  = &user.Project | ||||
| 	} | ||||
| 	} // ADMINS && SUPPORT w/o additional conditions | ||||
|  | ||||
| 	tags, counts, err := jobRepo.CountTags(username, project) | ||||
| 	tagMap := make(map[string][]map[string]interface{}) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user