Example #1
0
        public GroupPermissions GetGroupPermissions(MGGroup group, GroupAdministration.AssociationTypes associationType)
        {
            if (group == null)
            {
                Logger.LogError(5, "NULL  group found can not find permissions.");
                return(null);
            }
            GroupPermissions groupPermissions = null;
            GroupOperations  groupOps         = null;

            Logger.Log("Getting group permissions for group with ID " + group.ID + " and name " + group.Name + "...");
            try
            {
                Logger.Log("Getting group security permission key value pairs ...");

                // Extract the Application Level list of groups, along with the relevant cross references to Users and the content etc ...
                groupOps = new GroupOperations(Lcf);

                Logger.Log("Start getting groups->content lookup...");
                List <MGSecurityTag> groupContentList = groupOps.GetGroupContentDictionary(group.ID, associationType);
                if (groupContentList == null)
                {
                    Logger.LogError(5, "Got NULL list for group with name " + group.Name + " and ID " + group.ID + " groups->content lookup, abandoning getting group permissions!");
                    return(null);
                }

                Logger.Log("Start getting groups->display lookup...");
                List <MGSecurityTag> groupDisplayList = groupOps.GetGroupDisplayDictionary(group.ID, associationType);
                if (groupDisplayList == null)
                {
                    Logger.LogError(5, "Got NULL list for group with name " + group.Name + " and ID " + group.ID + " groups->display lookup, abandoning getting group permissions!");
                    return(null);
                }

                Logger.Log("Start getting groups->functionality lookup...");
                List <MGSecurityTag> groupFunctionalityList = groupOps.GetGroupFunctionalityDictionary(group.ID, associationType);
                if (groupFunctionalityList == null)
                {
                    Logger.LogError(5, "Got NULL list for group with name " + group.Name + " and ID " + group.ID + " groups->functionality lookup, abandoning getting group permissions!");
                    return(null);
                }

                Logger.Log("Finished getting group security permission key value pairs.");

                groupPermissions = GetGroupPermissions(group, groupContentList, groupDisplayList, groupFunctionalityList);
                if (groupPermissions == null)
                {
                    Logger.LogError(5, "Failed to get group permissions for group with name " + group.Name + " and ID " + group.ID + "!");
                    return(null);
                }
                Logger.Log("Finished getting group permissions for group with name " + group.Name + " and ID " + group.ID + ".");
            }
            catch (Exception ex)
            {
                Logger.LogError(5, "Error getting all group permissions at " + ex.StackTrace);
                groupPermissions = null;
            }
            finally
            {
                if (groupOps != null)
                {
                    groupOps.Finish();
                }
            }
            return(groupPermissions);
        }