@@ -153,9 +153,54 @@ def user_in_group(username: str, group: str) -> bool:
153153 return False
154154
155155
156+ def user_in_ou (username : str , ou : str ) -> bool :
157+ """Checks if a user is in an OU.
158+
159+ Args:
160+ username (str): The user@compiler.la to check for membership in the group.
161+ ou (str): The name of an OU to check for username's membership.
162+ Returns:
163+ True if the user is a member of the OU. False otherwise.
164+ """
165+ if user_exists (username ):
166+ with NamedTemporaryFile ("w+" ) as stdout :
167+ CallGAMCommand (("info" , "ou" , ou ), stdout = stdout .name , stderr = "stdout" )
168+ output = "\n " .join (stdout .readlines ())
169+ return username in output
170+ else :
171+ print (f"User does not exist: { username } " )
172+ return False
173+
174+
175+ def user_is_deactivated (username : str ) -> bool :
176+ """Checks if a user is in an OU.
177+
178+ Args:
179+ username (str): The user@compiler.la to check for membership in the group.
180+ ou (str): The name of an OU to check for username's membership.
181+ Returns:
182+ True if the user is a member of the OU. False otherwise.
183+ """
184+ return user_in_ou (username , OU_ALUMNI )
185+
186+
156187def user_is_partner (username : str ) -> bool :
188+ """Checks if a user is a Compiler Partner.
189+
190+ Args:
191+ username (str): The user@compiler.la to check for partner status.
192+ Returns:
193+ True if the user is a Partner. False otherwise.
194+ """
157195 return user_in_group (username , GROUP_PARTNERS )
158196
159197
160198def user_is_staff (username : str ) -> bool :
199+ """Checks if a user is a Compiler Staff.
200+
201+ Args:
202+ username (str): The user@compiler.la to check for staff status.
203+ Returns:
204+ True if the user is a Staff. False otherwise.
205+ """
161206 return user_in_group (username , GROUP_STAFF )
0 commit comments