Contest Management System (CMS) How to create and assign teams with their flags to users
The purpose of this post is to show how to create teams, assign flag images to them and then group users to those teams for the Contest Management System (http://cms-dev.github.io/ https://github.com/cms-dev/).
According to the documentation (https://cms.readthedocs.org/en/v1.2/RankingWebServer.html?highlight=teams#logo-flags-and-faces) flags and faces are part of the cmsRankingWebServer
so the first thing to do is to identify the location where cmsRankingWebServer
stores its data. Again, according to the documentation (https://cms.readthedocs.org/en/v1.2/RankingWebServer.html?highlight=teams#managing-it) the location we need is /var/local/lib/cms/ranking
.
Please note that if you create a new team, while the cmsRankingWebServer
is active, the change will not appear in the ranking website. Be sure to restart cmsRankingWebServer
when you create new teams.
Teams
First of all, make sure that the folder /var/local/lib/cms/ranking/teams
exists. If it does not, then create it with mkdir /var/local/lib/cms/ranking/teams
(most probably you will need to have root access rights to complete this command).
Then, for each team you want to create follow these steps:
- In the folder teams create JSON a file using the name of the team (e.g. if the team is named ‘
rocket
‘ then create the filerocket.json
in the folder teams) - In the JSON file you need to write the configuration for the team and define the name of the team in a JSON object that has one property called name (e.g. for
team rocket
the contents of therocket.json
file should be{"name": "rocket"}
)
Flags
Similar to before, make sure that the folder /var/local/lib/cms/ranking/flags
exists. If it does not, then create it with mkdir /var/local/lib/cms/ranking/flags
(most probably you will need to have root access rights to complete this command).
Then, for each team you want to assign a flag, make sure you created the configuration file described above and place in the flags folder an image that has the same name as the team. For example, if you want to assign a PNG image
to team rocket
, then you need to copy the image in the flags folder
using the name rocket.png
. Note that the image type can be any of the following .png, .jpg, .gif and .bmp
.
Assigning users to teams
To assign a user to a team, you need to modify the configuration file of the user in /var/local/lib/cms/ranking/users
. The files are JSON files named using the username
of each user (e.g. The configuration file for the user admin
would be /var/local/lib/cms/ranking/users/admin.json
).
In the file there is some basic information for the user. The following are sample contents from a random competition: {"l_name": "Shimura", "f_name": "Shinpachi", "team": null}
. You will notice that there is a field called team
in the object but is set to null
. We need to update that field to the name of the team we want to assign the user to (e.g. if we want to assign the user admin
to team rocket
, then we modify the contents of the configuration file admin.json
to {"l_name": "Shimura", "f_name": "Shinpachi", "team": "rocket"}
)