Skip to content

Udacity Data Structures and Algorithms Nanodegree Project_2, Problem_4

Notifications You must be signed in to change notification settings

Mcan45/Active-Directory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Active-Directory

In Windows Active Directory, a group can consist of user(s) and group(s) themselves. We can construct this hierarchy as such. Where User is represented by str representing their ids.

class Group(object): def init(self, _name): self.name = _name self.groups = [] self.users = []

def add_group(self, group):
    self.groups.append(group)

def add_user(self, user):
    self.users.append(user)

def get_groups(self):
    return self.groups

def get_users(self):
    return self.users

def get_name(self):
    return self.name

parent = Group("parent") child = Group("child") sub_child = Group("subchild")

sub_child_user = "sub_child_user" sub_child.add_user(sub_child_user)

child.add_group(sub_child) parent.add_group(child) Write a function that provides an efficient look up of whether the user is in a group.

def is_user_in_group(user, group): """ Return True if user is in the group, False otherwise.

Args:
  user(str): user name/id
  group(class:Group): group to check user membership against
"""
return None

About

Udacity Data Structures and Algorithms Nanodegree Project_2, Problem_4

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages