Repository: ansible-collections/community.general

Issue:
support for new gitlab api features
### Summary

Gitlab API has new features added to support enabling/disabling/access control some parts of git repository, they are as follows:

- `releases_access_level`: to control the visibility of  `release tab` in web-ui
- `environments_access_level`: to control the visibility of `environment tab` in web-ui
- `feature_flags_access_level`: to control the visibility of `feature tab` in web-ui
- `infrastructure_access_level`: to control the visibility of `infrastructure tab` in web-ui
- `monitor_access_level`: to control the visibility of `monitoring tab` in web-ui
- `security_and_compliance_access_level`:  to control the visibility of `security and compliance tab` in web-ui

### Issue Type

Feature Idea

### Component Name

gitlab_project

### Additional Information
Example of project creation using new fields

```yaml (paste below)
- name: Setup gitlab project
  community.general.gitlab_project:
    api_url: https://gitlab.example.com/
    validate_certs: true
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_project
    group: ansible
    releases_access_level: enabled
    environments_access_level: disabled
    feature_flags_access_level: disabled
    infrastructure_access_level: disabled
    monitor_access_level: disabled
    security_and_compliance_access_level: disabled
    state: present
  delegate_to: localhost
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/gitlab_project.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/gitlab_project.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @Lunik @Shaps @dj-wasabi @lgatellier @marwatk @metanovii @nejch @scodeman @sh0shin @suukit @waheedi @zanssa
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
This is the kind of cat-and-mouse game with implementing GitLab API attributes that I described in https://github.com/ansible-collections/community.general/issues/4577#issuecomment-1109971115.

I think it would be easier to do this by transparently passing API params to GitLab and let the server do the validation, but I haven't gotten back to that topic myself.
I would agree to that as there are quite many fields which are being added as well as deprecated so it would be a hassle to always update it. Allowing direct passing would allow users to use any field which is supported or not supported by gitlab_project

If we should pass directly the attributes, then I would be happy to do a PR with these changes

Resolving patch:
diff --git a/plugins/modules/gitlab_project.py b/plugins/modules/gitlab_project.py
--- a/plugins/modules/gitlab_project.py
+++ b/plugins/modules/gitlab_project.py
@@ -203,6 +203,54 @@
     type: str
     choices: ["private", "disabled", "enabled"]
     version_added: "6.2.0"
+  releases_access_level:
+    description:
+      - C(private) means that accessing release is allowed only to project members.
+      - C(disabled) means that accessing release is disabled.
+      - C(enabled) means that accessing release is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
+  environments_access_level:
+    description:
+      - C(private) means that deployment to environment is allowed only to project members.
+      - C(disabled) means that deployment to environment is disabled.
+      - C(enabled) means that deployment to environment is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
+  feature_flags_access_level:
+    description:
+      - C(private) means that feature rollout is allowed only to project members.
+      - C(disabled) means that feature rollout is disabled.
+      - C(enabled) means that feature rollout is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
+  infrastructure_access_level:
+    description:
+      - C(private) means that configuring infrastructure is allowed only to project members.
+      - C(disabled) means that configuring infrastructure is disabled.
+      - C(enabled) means that configuring infrastructure is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
+  monitor_access_level:
+    description:
+      - C(private) means that monitoring health is allowed only to project members.
+      - C(disabled) means that monitoring health is disabled.
+      - C(enabled) means that monitoring health is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
+  security_and_compliance_access_level:
+    description:
+      - C(private) means that accessing security and complicance tab is allowed only to project members.
+      - C(disabled) means that accessing security and complicance tab is disabled.
+      - C(enabled) means that accessing security and complicance tab is enabled.
+    type: str
+    choices: ["private", "disabled", "enabled"]
+    version_added: "6.4.0"
 '''
 
 EXAMPLES = r'''
@@ -321,6 +369,12 @@ def create_or_update_project(self, project_name, namespace, options):
             'builds_access_level': options['builds_access_level'],
             'forking_access_level': options['forking_access_level'],
             'container_registry_access_level': options['container_registry_access_level'],
+            'releases_access_level': options['releases_access_level'],
+            'environments_access_level': options['environments_access_level'],
+            'feature_flags_access_level': options['feature_flags_access_level'],
+            'infrastructure_access_level': options['infrastructure_access_level'],
+            'monitor_access_level': options['monitor_access_level'],
+            'security_and_compliance_access_level': options['security_and_compliance_access_level'],
         }
         # Because we have already call userExists in main()
         if self.project_object is None:
@@ -454,6 +508,12 @@ def main():
         builds_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
         forking_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
         container_registry_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        releases_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        environments_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        feature_flags_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        infrastructure_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        monitor_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
+        security_and_compliance_access_level=dict(type='str', choices=['private', 'disabled', 'enabled']),
     ))
 
     module = AnsibleModule(
@@ -504,6 +564,12 @@ def main():
     builds_access_level = module.params['builds_access_level']
     forking_access_level = module.params['forking_access_level']
     container_registry_access_level = module.params['container_registry_access_level']
+    releases_access_level = module.params['releases_access_level']
+    environments_access_level = module.params['environments_access_level']
+    feature_flags_access_level = module.params['feature_flags_access_level']
+    infrastructure_access_level = module.params['infrastructure_access_level']
+    monitor_access_level = module.params['monitor_access_level']
+    security_and_compliance_access_level = module.params['security_and_compliance_access_level']
 
     if default_branch and not initialize_with_readme:
         module.fail_json(msg="Param default_branch need param initialize_with_readme set to true")
@@ -576,6 +642,12 @@ def main():
             "builds_access_level": builds_access_level,
             "forking_access_level": forking_access_level,
             "container_registry_access_level": container_registry_access_level,
+            "releases_access_level": releases_access_level,
+            "environments_access_level": environments_access_level,
+            "feature_flags_access_level": feature_flags_access_level,
+            "infrastructure_access_level": infrastructure_access_level,
+            "monitor_access_level": monitor_access_level,
+            "security_and_compliance_access_level": security_and_compliance_access_level,
         }):
 
             module.exit_json(changed=True, msg="Successfully created or updated the project %s" % project_name, project=gitlab_project.project_object._attrs)


Test patch: