Commit cc30d0b0 authored by marcus.hardt's avatar marcus.hardt

Merge branch 'improve-primary-group-handling' into 'master'

Improve primary group handling

Closes #26

See merge request !31
parents 02520bce 24cf931d
......@@ -41,6 +41,15 @@ class User:
self.service_user = backend.User(self.data)
self.service_groups = [backend.Group(grp) for grp in self.data.groups]
logger.info("/--------------------------------------------------------------------------------\\")
logger.info(F"primary group: {UserInfo(data).primary_group}")
logger.info("--------------------------------------------------------------------------------")
logger.info("self.service_groups: ")
for group in self.service_groups:
logger.info(F" {group.name}")
logger.info("\\--------------------------------------------------------------------------------/")
def assurance_verifier(self):
"""Produce a suitably function to check if a user is allowed.
......@@ -252,7 +261,7 @@ class User:
Create the groups on the service, if necessary.
"""
for group in filter(lambda grp: not grp.exists(), self.service_groups):
for group in filter(lambda grp: not grp.exists(), [self.service_user.primary_group] + self.service_groups):
logger.info("Creating group {}".format(group.name))
group.create()
......
......@@ -198,6 +198,7 @@ class User:
if supplementary_groups is not None:
current_groups = [grp for grp in reg_info['secondaryGroups']]
new_groups = [grp.reg_info(short=True) for grp in supplementary_groups]
new_groups += [self.primary_group.reg_info()]
logger.debug("Groups according to BWIDM: {}".format([g['name'] for g in current_groups]))
logger.debug("Groups according to FEUDAL: {}".format([g['name'] for g in new_groups]))
......
......@@ -7,7 +7,7 @@ with open("README.md", "r") as me:
setuptools.setup(
name="ldf_adapter",
version="0.1.2",
version="0.1.2-dev1",
author="Joshua Bachmeier",
author_email="joshua.bachmeier@student.kit.edu",
description="LDF Adapter to connect BWIDM and FEUDAL",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment