Exemplo n.º 1
0
        public ProfileUser Get(string username)
        {
            var user = bridge.GetUser(username);

            if (user == null)
            {
                return(null);
            }

            var profile = new ProfileUser {
                Name = username, Email = user.Email
            };

            var clientSettings = user.DetailCollections["Settings"];

            foreach (var setting in clientSettings.Details)
            {
                if (setting.Meta != null)
                {
                    profile.Settings[setting.Meta] = setting.Value;
                }
            }

            return(profile);
        }
        public override int DeleteProfiles(string[] usernames)
        {
            int count = 0;

            foreach (string username in usernames)
            {
                ContentItem user = Bridge.GetUser(username);
                if (user != null)
                {
                    Bridge.Delete(user);
                    count++;
                }
            }
            return(count);
        }
Exemplo n.º 3
0
 public override void AddUsersToRoles(string[] usernames, string[] roleNames)
 {
     foreach (string username in usernames)
     {
         Items.User u = Bridge.GetUser(username);
         foreach (string role in roleNames)
         {
             if (!u.Roles.Contains(role))
             {
                 u.Roles.Add(role);
                 Bridge.Save(u);
             }
         }
     }
 }