fortify / fcli

fcli is a command-line utility for interacting with various Fortify products
https://fortify.github.io/fcli/
Other
33 stars 22 forks source link

FoD/SSC: Reconsider commands/options for managing app/user/group assignments #369

Closed rsenden closed 1 year ago

rsenden commented 1 year ago

SSC & FoD modules currently provide a very different command/option structure for managing user assignments to apps/versions/groups:

SSC:

FoD:

Observations:

We should come up with a consistent command/option structure between fcli ssc and fcli fod modules that allows for providing a full feature set, with functionality for listing/managing assignments at both user-level and entity-level, like adding/listing/removing (one or more) users for an individual app/version, and add/list/remove (one or more) apps/versions for an individual user.

Primary question is whether we want to represent assign/remove actions as options (like in the current fcli fod user update --add-apps/add-groups options), or as actions (like in the current fcli ssc appversion-user add/rm commands)?

Modeled as options:

Modeled as sub-commands:

When choosing the sub-command based approach, what would be the best command structure? Some examples:

Any other ideas/suggestions/preferences?

kadraman commented 1 year ago

FoD UI only allows groups to be added at creation time so that's all I put on fod app create - we could also have users as an option but it would required another API call so not atomic. It might be better to remove groups option and rely on separate and subsequent commands to do this (like below).

FOD UI allows users and groups to be added to app, so we definitely need that; I do like fod app add-users, fod app remove-users, fod app add-groups, fod app remove-groups.

FOD UI also allows users/groups to be explicitly assigned to applications so I think it might make sense to keep these options on fod user create|update and fod group create|update.

FOD UI also allows users and groups to be explicitly assigned to applications - so these should probably be kept?

rsenden commented 1 year ago

Another consideration to keep in mind; in general, all actions within a single entity should return/output the same record type. For example, ideally, all fcli fod app * commands should output app records. Commands for adding/removing/listing users/groups will likely output user records, and hence should probably be under a separate parent command like app-user.

psmf22 commented 1 year ago

In my opinion having an app-user command makes sense and would also give us a good place for list commands in either direction like fod app-user list-apps --user or fod app-user list-users -appid

I think for clarity´s sake having separate add commands would be preferable, though under a single entity. For example fod app-user add-apps --user --apps and fod app-user add-users --appid --users

In case we would like to enable both way mass assignment having a single fod app-user add --apps --users command would be my preference.

rsenden commented 1 year ago

@psmf22 Thanks for the input. Apart from assigning users, we'll also need to be able to assign groups (and for SSC, assign local users or LDAP entities). Should we have separate entities, like fod app-user and fod app-groups, or maybe have a generic fod app-access instead? Thoughts?

rsenden commented 1 year ago

For now, we've decided to postpone this decision until after 2.0.0 has been released. In FoD, all commands and options related to assigning users/groups/... have been marked as PREVIEW or DEPRECATED (to be double-checked that all relevant commands and options have been covered), don't remember for sure whether this has also already been done for SSC, otherwise this should be done before releasing 2.0.0.

rsenden commented 1 year ago

For SSC, I've now implemented an access-control entity for managing roles, users, and user assignments. Adding/removing users to an appversion is (for now) done through the appversion create/update commands, not sure whether we should (also) have dedicated user assignment commands under access-control. Also not sure whether we should (also) have an appversion list-users command.

For FoD, we should probably adopt a similar structure, moving current user and user-group commands to a new access-control entity.

rsenden commented 1 year ago

A new access-control entity has now been implemented for FoD as well, so this issue can be closed.