コード例 #1
0
    /// <summary>
    /// Return the group manager for the group
    /// </summary>
    /// <param name="group"></param>
    /// <param name="ifCreateGrantLicenseMode">If a group needs to be created, give it this Grant License Mode</param>
    /// <param name="ifCreateGrantLicenseRole">If the group needs to be created, give it this Grant License Role</param>
    /// <returns></returns>
    public SingleGroupManager GetManagerForGroup_CreateIfNeeded(
        string group,
        ProvisioningGroup.GrantLicenseMode ifCreateGrantLicenseMode,
        string ifCreateGrantLicenseRole)
    {
        var cannonicalGroup = group.ToLower();
        SingleGroupManager thisGroupManager;

        //Prevent this from getting entered my multiple threads
        lock (_threadLock_ModifyGroupsList)
        {
            //Add the user to a group manager
            _groupsManager.TryGetValue(cannonicalGroup, out thisGroupManager);

            if (thisGroupManager == null)
            {
                thisGroupManager = new SingleGroupManager(group, ifCreateGrantLicenseMode, ifCreateGrantLicenseRole);
                _groupsManager.Add(cannonicalGroup, thisGroupManager);
            }
            else
            {
                //Check to see if this definition of the group specifies a BETTER Grant License behavior,
                //if so, apply that
                thisGroupManager.ConsiderGrantLicenseRoleUpgrade(ifCreateGrantLicenseMode, ifCreateGrantLicenseRole);
            }
        }
        return(thisGroupManager);
    }
コード例 #2
0
    /// <summary>
    /// Return the group manager for the group
    /// </summary>
    /// <param name="group"></param>
    /// <returns></returns>
    private SingleGroupManager GetManagerForGroup(string group)
    {
        var cannonicalGroup = group.ToLower();
        SingleGroupManager thisGroupManager = null;

        //Add the user to a group manager
        _groupsManager.TryGetValue(cannonicalGroup, out thisGroupManager);
        if (thisGroupManager == null)
        {
            thisGroupManager = new SingleGroupManager(group);
            _groupsManager.Add(cannonicalGroup, thisGroupManager);
        }

        return(thisGroupManager);
    }