Skip to content

Commit a312892

Browse files
committed
🚚 Rename disable-groups-of-groups to disable-mirrored-groups
1 parent 6a056aa commit a312892

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ member: <DN for each user belonging to this group>
6767

6868
## Primary groups
6969

70-
Note that each user will have an associated group to act as its POSIX user primary group
70+
:exclamation: You can disable the creation of mirrored groups with the `--disable-primary-groups` command line option :exclamation:
71+
72+
Apricot creates an associated group for each user, which acts as its POSIX user primary group.
7173

7274
For example:
7375

apricot/apricot_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(
2222
port: int,
2323
*,
2424
debug: bool = False,
25-
enable_group_of_groups: bool,
25+
enable_mirrored_groups: bool,
2626
redis_host: str | None = None,
2727
redis_port: int | None = None,
2828
**kwargs: Any,
@@ -64,7 +64,7 @@ def __init__(
6464
if self.debug:
6565
log.msg("Creating an LDAPServerFactory.")
6666
factory = OAuthLDAPServerFactory(
67-
domain, oauth_client, enable_group_of_groups=enable_group_of_groups
67+
domain, oauth_client, enable_mirrored_groups=enable_mirrored_groups
6868
)
6969

7070
# Attach a listening endpoint

apricot/ldap/oauth_ldap_server_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
class OAuthLDAPServerFactory(ServerFactory):
1111
def __init__(
12-
self, domain: str, oauth_client: OAuthClient, *, enable_group_of_groups: bool
12+
self, domain: str, oauth_client: OAuthClient, *, enable_mirrored_groups: bool
1313
):
1414
"""
1515
Initialise an LDAPServerFactory
1616
1717
@param oauth_client: An OAuth client used to construct the LDAP tree
1818
"""
1919
# Create an LDAP lookup tree
20-
self.adaptor = OAuthLDAPTree(domain, oauth_client, enable_group_of_groups)
20+
self.adaptor = OAuthLDAPTree(domain, oauth_client, enable_mirrored_groups)
2121

2222
def __repr__(self) -> str:
2323
return f"{self.__class__.__name__} using adaptor {self.adaptor}"

apricot/ldap/oauth_ldap_tree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(
1818
domain: str,
1919
oauth_client: OAuthClient,
2020
*,
21-
enable_group_of_groups: bool,
21+
enable_mirrored_groups: bool,
2222
refresh_interval: int = 60,
2323
) -> None:
2424
"""
@@ -34,7 +34,7 @@ def __init__(
3434
self.oauth_client = oauth_client
3535
self.refresh_interval = refresh_interval
3636
self.root_: OAuthLDAPEntry | None = None
37-
self.enable_group_of_groups = enable_group_of_groups
37+
self.enable_mirrored_groups = enable_mirrored_groups
3838

3939
@property
4040
def dn(self) -> DistinguishedName:
@@ -56,7 +56,7 @@ def root(self) -> OAuthLDAPEntry:
5656
oauth_adaptor = OAuthDataAdaptor(
5757
self.domain,
5858
self.oauth_client,
59-
enable_group_of_groups=self.enable_group_of_groups,
59+
enable_mirrored_groups=self.enable_mirrored_groups,
6060
)
6161

6262
# Create a root node for the tree

apricot/oauth/oauth_data_adaptor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ class OAuthDataAdaptor:
2222
"""Adaptor for converting raw user and group data into LDAP format."""
2323

2424
def __init__(
25-
self, domain: str, oauth_client: OAuthClient, *, enable_group_of_groups: bool
25+
self, domain: str, oauth_client: OAuthClient, *, enable_mirrored_groups: bool
2626
):
2727
self.debug = oauth_client.debug
2828
self.oauth_client = oauth_client
2929
self.root_dn = "DC=" + domain.replace(".", ",DC=")
30-
self.enable_group_of_groups = enable_group_of_groups
30+
self.enable_mirrored_groups = enable_mirrored_groups
3131

3232
# Retrieve and validate user and group information
3333
annotated_groups, annotated_users = self._retrieve_entries()
@@ -108,7 +108,7 @@ def _retrieve_entries(
108108
# Add one group of groups for each existing group.
109109
# Its members are the primary user groups for each original group member.
110110
groups_of_groups = []
111-
if self.enable_group_of_groups:
111+
if self.enable_mirrored_groups:
112112
for group in oauth_groups:
113113
group_dict = {}
114114
group_dict["cn"] = f"Primary user groups for {group['cn']}"

docker/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ if [ -n "${DEBUG}" ]; then
3737
EXTRA_OPTS="${EXTRA_OPTS} --debug"
3838
fi
3939

40-
if [ -n "${DISABLE_GROUP_OF_GROUPS}" ]; then
41-
EXTRA_OPTS="${EXTRA_OPTS} --disable-group-of-groups"
40+
if [ -n "${DISABLE_MIRRORED_GROUPS}" ]; then
41+
EXTRA_OPTS="${EXTRA_OPTS} --disable-mirrored-groups"
4242
fi
4343

4444
if [ -n "${ENTRA_TENANT_ID}" ]; then

run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
parser.add_argument("-i", "--client-id", type=str, help="OAuth client ID.")
1717
parser.add_argument("-p", "--port", type=int, default=1389, help="Port to run on.")
1818
parser.add_argument("-s", "--client-secret", type=str, help="OAuth client secret.")
19-
parser.add_argument("--disable-group-of-groups", action="store_false",
20-
dest="enable_group_of_groups", default=True,
21-
help="Disable creation of group-of-groups.")
19+
parser.add_argument("--disable-mirrored-groups", action="store_false",
20+
dest="enable_mirrored", default=True,
21+
help="Disable creation of mirrored groups.")
2222
parser.add_argument("--debug", action="store_true", help="Enable debug logging.")
2323
# Options for Microsoft Entra backend
2424
entra_group = parser.add_argument_group("Microsoft Entra")

0 commit comments

Comments
 (0)