Refactor credentials inventory structure
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem
The existing credentials inventory Controller/View structure is confusing, with overrides of actions and helpers taking place at the controller level. This makes it harder to discern what is happening and doesn't keep a clear distinction between Controllers and Views.
Proposed change
We should restructure the credentials inventory Controller/View structure so we are not overriding helpers in the controller. There may also be additional gains to be made to make better use of module hierarchy allowing us to share actions and helpers without needing to mash them together in weird and wonderful ways.
Existing structure
classDiagram
CredentialsInventoryActions <|-- AdminCredentialsController
CredentialsInventoryActions <|-- GroupsSecurityCredentialsController
CredentialsInventoryHelpers <|-- CredentialsInventoryActions
CredentialsInventoryHelpers <|-- SharedCredentialsInventoryIndexView
CredentialsInventoryHelpers <|-- SharedCredentialsInventoryTokenView
CredentialsInventoryHelpers <|-- SharedCredentialsInventoryKeyView
CredentialsInventoryActions <|-- SharedCredentialsInventoryIndexView
CredentialsInventoryActions <|-- SharedCredentialsInventoryUserDetailsView
SharedCredentialsInventoryIndexView <|-- SharedCredentialsInventoryPATsView
SharedCredentialsInventoryIndexView <|-- SharedCredentialsInventorySSHKeysView
SharedCredentialsInventoryPATsView <|-- SharedCredentialsInventoryTokenView
SharedCredentialsInventorySSHKeysView <|-- SharedCredentialsInventoryKeyView
SharedCredentialsInventoryTokenView <|-- SharedCredentialsInventoryUserDetailsView
SharedCredentialsInventoryTokenView <|-- SharedCredentialsInventoryExpiryDateView
SharedCredentialsInventoryKeyView <|-- SharedCredentialsInventoryUserDetailsView
SharedCredentialsInventoryKeyView <|-- SharedCredentialsInventoryExpiryDateView
class CredentialsInventoryHelpers {
-VALID_FILTERS
+ show_personal_access_token?()
+ show_ssh_keys?()
+ credentials_inventory_feature_available?()
+ revoke_button_available?()
+ credentials_inventory_path(args)
+ user_detail_path(user)
+ personal_access_token_revoke_path(token)
}
class CredentialsInventoryActions {
+Hash @credentials
+String gender
+index()
+revoke()
-filter_credentials()
-users()
}
class AdminCredentialsController {
-check_license_credentials_inventory_available!()
-credentials_inventory_path()
-user_detail_path()
-personal_access_token_revoke_path()
-revoke_button_available()
-users()
}
class GroupsSecurityCredentialsController {
+Group group
-validate_group_level_credentials_inventory_available!()
-credentials_inventory_path()
-user_detail_path()
-users()
}
class SharedCredentialsInventoryIndexView {
+Hash @credentials
+credentials_inventory_path(args)
+show_personal_access_tokens?()
+show_ssh_keys?()
}
class SharedCredentialsInventoryTokenView {
+revoke_button_available?()
+personal_access_token_revoke_path(token)
}
class SharedCredentialsInventoryUserDetailsView {
+user_detail_path(user)
}
Edited by 🤖 GitLab Bot 🤖