コード例 #1
0
        private List<string> GetRole( string role )
        {
            Dictionary<string, List<string>> applicationRoles = GetRoles();

            if ( applicationRoles == null )
            {
                applicationRoles = new Dictionary<string, List<string>>();

                GroupService GroupService = new GroupService();

                Rock.Models.Groups.Group groupModel = GroupService.GetGroupByGuid( new Guid( role ) );
                if (groupModel != null)
                {
                    List<string> usernames = new List<string>();

                    foreach ( Rock.Models.Groups.Member member in groupModel.Members)
                        foreach ( Rock.Models.Cms.User userModel in member.Person.Users)
                            usernames.Add( userModel.Username );

                    applicationRoles.Add( groupModel.Name, usernames );
                }
            }

            if ( applicationRoles.ContainsKey( role ) )
                return applicationRoles[role];
            else
                return null;
        }