Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to import teams' agents #693

Closed
marien-probesys opened this issue Aug 2, 2024 · 1 comment
Closed

Allow to import teams' agents #693

marien-probesys opened this issue Aug 2, 2024 · 1 comment
Labels
type: improvements Things could be nicer

Comments

@marien-probesys
Copy link
Member

Problem

Today, we can import users and teams with their respective (team) authorizations. However, we cannot import teams' agents (see #692). This is because agents' authorizations must be linked to the corresponding teams' authorizations. This is usually done by the TeamService (see the documentation to learn about the implementation).

Taking an hypothetical example.

roles.json

[
    {
        "id": "1",
        "name": "Technician",
        "description": "Technician description",
        "type": "agent"
    }
]

users.json

[
    {
        "id": "1",
        "email": "[email protected]",
        "authorizations": [
            {
                "roleId": "1",
                "organizationId": null,
            }
        ]
    }
]

teams.json

[
    {
        "id": "1",
        "name": "Web team",
        "agentIds": ["1"],
        "teamAuthorizations": [
            {
            	"roleId": "1",
            	"organizationId": null
            }
        ]
    }
]

Now we want to link the user's authorization to the team's authorization (because they represent the same authorization).
We could simply add an id to the teamAuthorization object, and add a reference to this object in the user's authorization object. But both objects could be out of sync, which wouldn't be good either.
We also could simplify the authorization object with just the reference to the teamAuthorization object. But as teams are imported after users, that wouldn't work either because the reference would be null.

Solution

We should just not include "team authorizations" inside of the users' authorizations.
When we import teams, the DataImporter service should add the authorizations to the agents itself.

@marien-probesys
Copy link
Member Author

Replaced by #751

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvements Things could be nicer
Projects
None yet
Development

No branches or pull requests

1 participant