The front end of the Groups sub-system. Contains the implementation of the Group support functions as used in the Mediator Pattern. More...
Go to the source code of this file.
Functions | |
void | Groups_Clear (void) |
Release all memory associated with list of groups. | |
GroupErrorCode | Groups_AddGroup (const char *groupName) |
Add a group to the list of groups. | |
GroupErrorCode | Groups_RemoveGroup (const char *groupName) |
Remove a group from the list of groups. | |
Group * | Groups_FindGroup (const char *groupName) |
Find a group from the list of groups given the group's name. | |
bool | Groups_UserInGroup (const char *userName, const char *groupName) |
Determine if the specified user is in this group. This is a case- sensitive search. | |
GroupErrorCode | Groups_AddUserGroup (const char *userName, const char *groupName) |
Add the specified user to the specified group. If the user is already in the group, the operation is ignored. | |
GroupErrorCode | Groups_RemoveUserFromGroup (const char *userName, const char *groupName) |
Remove the specified user from the specified group. If the user is not in the group, the operation is ignored. | |
GroupErrorCode | Groups_RemoveUserFromAllGroups (const char *userName) |
Remove the specified user from all groups. | |
GroupErrorCode | Groups_GetAllGroups (StringList *groups) |
Retrieve a list of all group names. | |
GroupErrorCode | Groups_GetAllUsersInGroup (const char *groupName, StringList *users) |
Retrieve a list of all users in the specified group. | |
GroupErrorCode | Groups_GetGroupsWithUser (const char *userName, StringList *groups) |
Retrieve a list of all groups that contains the given user. | |
Variables | |
static GroupList | _groups = { 0 } |
The list of all groups. | |
The front end of the Groups sub-system. Contains the implementation of the Group support functions as used in the Mediator Pattern.
Definition in file Mediator_Groups.c.
GroupErrorCode Groups_AddGroup | ( | const char * | groupName | ) |
Add a group to the list of groups.
groupName | Name of the group to add. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the groupName parameter is NULL. |
GroupErrorCode_Group_Does_Not_Exist | indicates the group does not exist. |
GroupErrorCode_No_Memory | indicates an out of memory condition. |
Definition at line 30 of file Mediator_Groups.c.
References _groups, Group_Create(), Group_Destroy(), GroupErrorCode_No_Error, GroupErrorCode_No_Memory, GroupErrorCode_Null_Argument, GroupList_AddGroup(), and GroupList_FindGroup().
Referenced by Mediator_AddGroup().
GroupErrorCode Groups_AddUserGroup | ( | const char * | userName, |
const char * | groupName | ||
) |
Add the specified user to the specified group. If the user is already in the group, the operation is ignored.
userName | Name of the user to add. Cannot be null or empty. |
groupName | Name of the group to add to. Cannot be null or empty. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the userName or groupName parameter is NULL. |
GroupErrorCode_No_Memory | indicates an out of memory condition. |
Definition at line 124 of file Mediator_Groups.c.
References _groups, Group_AddUser(), GroupErrorCode_Group_Does_Not_Exist, GroupErrorCode_No_Error, GroupErrorCode_No_Memory, GroupErrorCode_Null_Argument, GroupList_FindGroup(), and GroupList::groups.
Referenced by Mediator_AddUserToGroup().
void Groups_Clear | ( | void | ) |
Release all memory associated with list of groups.
Definition at line 22 of file Mediator_Groups.c.
References _groups, and GroupList_Clear().
Referenced by Mediator_ClearAll().
Group * Groups_FindGroup | ( | const char * | groupName | ) |
Find a group from the list of groups given the group's name.
groupName | Name of the group to search for. |
Definition at line 84 of file Mediator_Groups.c.
References _groups, GroupList_FindGroup(), and GroupList::groups.
GroupErrorCode Groups_GetAllGroups | ( | StringList * | groups | ) |
Retrieve a list of all group names.
groups | A StringList object to be populated with the names of all groups. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the groups parameter is NULL. |
Definition at line 200 of file Mediator_Groups.c.
References _groups, GroupErrorCode_No_Error, GroupErrorCode_No_Memory, GroupErrorCode_Null_Argument, GroupList::groups, GroupList::groups_count, Group::Name, and StringList_AddString().
Referenced by Mediator_GetAllGroups().
GroupErrorCode Groups_GetAllUsersInGroup | ( | const char * | groupName, |
StringList * | users | ||
) |
Retrieve a list of all users in the specified group.
groupName | Name of the group to examine. |
users | A StringList object to be populated with the names of all users in the group. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the groupName or groups parameter is NULL. |
Definition at line 224 of file Mediator_Groups.c.
References _groups, Group_GetAllUsers(), GroupErrorCode_Group_Does_Not_Exist, GroupErrorCode_No_Error, GroupErrorCode_No_Memory, GroupErrorCode_Null_Argument, GroupList_FindGroup(), and GroupList::groups.
Referenced by Mediator_GetUsersInGroup().
GroupErrorCode Groups_GetGroupsWithUser | ( | const char * | userName, |
StringList * | groups | ||
) |
Retrieve a list of all groups that contains the given user.
userName | Name of the user to search for. |
groups | A StringList object to be filled with the names of groups containing the given user. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the userName or groups parameter is NULL. |
GroupErrorCode_No_Memory | indicates an out of memory condition. |
Definition at line 250 of file Mediator_Groups.c.
References _groups, Group_FindUser(), GroupErrorCode_No_Error, GroupErrorCode_No_Memory, GroupErrorCode_Null_Argument, GroupList::groups, GroupList::groups_count, Group::Name, and StringList_AddString().
Referenced by Mediator_GetGroupsWithUser().
GroupErrorCode Groups_RemoveGroup | ( | const char * | groupName | ) |
Remove a group from the list of groups.
groupName | Name of the group to remove. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the groupName parameter is NULL. |
GroupErrorCode_Group_Does_Not_Exist | indicates the group does not exist. |
Definition at line 62 of file Mediator_Groups.c.
References _groups, GroupErrorCode_Group_Does_Not_Exist, GroupErrorCode_No_Error, GroupErrorCode_Null_Argument, GroupList_FindGroup(), and GroupList_RemoveGroup().
Referenced by Mediator_RemoveGroup().
GroupErrorCode Groups_RemoveUserFromAllGroups | ( | const char * | userName | ) |
Remove the specified user from all groups.
userName | Name of the user to remove. Cannot be null. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the userName parameter is NULL. |
Definition at line 175 of file Mediator_Groups.c.
References _groups, Group_FindUser(), Group_RemoveUser(), GroupErrorCode_No_Error, GroupErrorCode_Null_Argument, GroupList::groups, and GroupList::groups_count.
Referenced by Mediator_RemoveUserFromAllGroups().
GroupErrorCode Groups_RemoveUserFromGroup | ( | const char * | userName, |
const char * | groupName | ||
) |
Remove the specified user from the specified group. If the user is not in the group, the operation is ignored.
userName | Name of the user to remove. Cannot be null or empty. |
groupName | Name of the group to remove from. Cannot be null or empty. |
GroupErrorCode_No_Error | indicates success. |
GroupErrorCode_Null_Argument | indicates the userName or groupName parameter is NULL. |
Definition at line 149 of file Mediator_Groups.c.
References _groups, Group_FindUser(), Group_RemoveUser(), GroupErrorCode_Group_Does_Not_Exist, GroupErrorCode_No_Error, GroupErrorCode_Null_Argument, GroupList_FindGroup(), and GroupList::groups.
Referenced by Mediator_RemoveUserFromGroup().
bool Groups_UserInGroup | ( | const char * | userName, |
const char * | groupName | ||
) |
Determine if the specified user is in this group. This is a case- sensitive search.
userName | Name of the user to look for. Should not be NULL. |
groupName | Name of the group to look in. Should not be NULL. |
Definition at line 104 of file Mediator_Groups.c.
References _groups, Group_FindUser(), GroupList_FindGroup(), and GroupList::groups.
Referenced by Mediator_AddUserToGroup(), Mediator_IsUserInGroup(), and Mediator_RemoveUserFromGroup().
|
static |
The list of all groups.
Definition at line 15 of file Mediator_Groups.c.
Referenced by Groups_AddGroup(), Groups_AddUserGroup(), Groups_Clear(), Groups_FindGroup(), Groups_GetAllGroups(), Groups_GetAllUsersInGroup(), Groups_GetGroupsWithUser(), Groups_RemoveGroup(), Groups_RemoveUserFromAllGroups(), Groups_RemoveUserFromGroup(), and Groups_UserInGroup().