Update user properties on the roster
493412
def update_users(self, entries):
        
        ws = IWorkspace(self.context)
        members = ws.members

        # check user permissions against join policy
        join_policy = self.context.join_policy
        if (join_policy == "admin"
            and not checkPermission(
                "collective.workspace: Manage roster",
                self.context)):
            raise Unauthorized("You are not allowed to add users here")

        for entry in entries:
            id = entry.get('id')
            is_member = bool(entry.get('member'))
            is_admin = bool(entry.get('admin'))

            # Existing members
            if id in members:
                member = members[id]
                if not is_member:
                    if checkPermission(
                            "ploneintranet.workspace: Manage workspace",
                            self.context):
                        ws.membership_factory(ws, member).remove_from_team()
                    else:
                        raise Unauthorized(
                            "Only team managers can remove members")
                elif not is_admin:
                    ws.membership_factory(ws, member).groups -= {'Admins'}
                else:
                    ws.membership_factory(ws, member).groups |= {'Admins'}

            # New members
            elif id not in members and (is_member or is_admin):
                groups = set()
                if is_admin:
                    groups.add('Admins')
                ws.add_to_team(user=id, groups=groups)
1271025
def update_rosters(game, away_id, home_id)
        game_id = find_or_create_game(game, nil, nil)
      
        gameday_info = GamedayUtil.parse_gameday_id('gid_' + game.gid)
        active_date = "#{gameday_info['year']}/#{gameday_info['month']}/#{gameday_info['day']}"
      
        away_res = @db.query("select id from rosters where team_id = '#{away_id}' and active_date = '#{active_date}'")
        away_roster_id=0
      
        found = false
        away_res.each do |row|
          found = true
          away_roster_id = row['id']
        end

        @db.query("UPDATE rosters SET game_id = '#{game_id}', home_or_away = 'a' WHERE id = '#{away_roster_id}'")

        home_res = @db.query("select id from rosters where team_id = '#{home_id}' and active_date = '#{active_date}'")
        home_roster_id=0
      
      
        found = false
        home_res.each do |row|
          found = true
          home_roster_id = row['id']
        end
      
        @db.query("UPDATE rosters SET game_id = '#{game_id}', home_or_away = 'h' WHERE id = '#{home_roster_id}'")
      end
637640
def update_payload(self, fields=None):
        """"""
        payload = super(HostCollection, self).update_payload(fields)
        if 'system_ids' in payload:
            payload['system_uuids'] = payload.pop('system_ids')
        return payload
267394
def refresh(self):
        
        self.invalidate()
        full = not self._manager._list_has_name
        res_list = self._manager.list(full_properties=full)
        self.update_from(res_list)
494716
def upgrade():
    """"""
    op.create_table(
        'userprofiles_userprofile',
        sa.Column('user_id', sa.Integer(), nullable=False),
        sa.Column('username', sa.String(length=255), nullable=True),
        sa.Column('displayname', sa.String(length=255), nullable=True),
        sa.Column('full_name', sa.String(length=255), nullable=False),
        sa.ForeignKeyConstraint(['user_id'], [u'accounts_user.id'], ),
        sa.PrimaryKeyConstraint('user_id'),
        sa.UniqueConstraint('username')
    )
701683
function updateProjectAssignment(req, res, next) {
  var projectId = req.params.projectId;
  var username = req.params.username;
  var dataStore = req.app.dataStore;

  // Get the project REST resource - /projects/{projectId}
  var resource = new swagger.Resource('/projects', projectId, null);
  dataStore.get(resource, function(err, resource) {
    if (resource) {
      var members = resource.data.assigned;
      var currentlyAssigned = members.indexOf(username) >= 0;

      // Add/remove the employee
      if (req.method === 'PUT' && !currentlyAssigned) {
        members.push(username);
      }
      else if (req.method === 'DELETE' && currentlyAssigned) {
        members.splice(members.indexOf(username), 1);
      }

      // Save changes
      dataStore.save(resource, next);
    }
    else {
      // The project ID does not exist, so respond with an HTTP 404 (Not Found)
      res.sendStatus(404);
    }
  });
}
809477
def UpdateUser(username, password=None, is_admin=False):
  """"""
  user_type, password = _GetUserTypeAndPassword(
      username, password=password, is_admin=is_admin)
  grr_api = maintenance_utils.InitGRRRootAPI()
  grr_user = grr_api.GrrUser(username).Get()
  grr_user.Modify(user_type=user_type, password=password)
373771
def change_nick(self, new_nick):
        """"""

        if self.logged_in:
            raise RuntimeError("User must be logged out")
        self.__verify_username(new_nick)

        self.conn.make_call("command", self.nick, "nick", new_nick)
        self.nick = new_nick
973259
def update_current_user(self, **params):
        """"""
        response = self._put('v2', 'user', data=params)
        return self._make_api_object(response, CurrentUser)
657093
def updateMember(self, data, address, id, headers=None, query_params=None, content_type="application/json"):
        
        uri = self.client.base_url + "/network/"+id+"/member/"+address
        return self.client.post(uri, data, headers, query_params, content_type)
15844
private function updateUsersTable()
    {
        Schema::table('users', function ($table) {
            foreach ($this->fields as $field => $value) {
                if (!Schema::hasColumn('users', $field)) {
                    $type  = $value['type'];
                    $query = $table->$type($field);

                    if (isset($value['extra'])) {
                        $extra = $value['extra'];
                        $query->$extra();
                    }

                    if ($field == 'role_id') {
                        $table->foreign('role_id')->references('id')->on('roles');
                    }
                }
            }

            if (!Schema::hasColumn('users', 'created_at') && !Schema::hasColumn('users', 'updated_at')) {
                $table->timestamps();
            }

            if (!Schema::hasColumn('users', 'deleted_at')) {
                $table->softDeletes();
            }
        });
    }
916310
def update_payload(self, fields=None):
        """"""
        payload = super(JobTemplate, self).update_payload(fields)
        effective_user = payload.pop(u'effective_user', None)
        if effective_user:
            payload[u'ssh'] = {u'effective_user': effective_user}
        return {u'job_template': payload}
383193
def update(self, nickname=None, **kwargs):
        
        url = self.url + 'hips/update'
        payload = {
            'membership': {
                'nickname': nickname,
            },
        }
        payload['membership'].update(kwargs)
        response = self.session.post(url, json=payload)
        return Member(self, self.group_id, **response.data)
400208
def _maybe_update(self, user, attribute, new_value):
        
        old_value = getattr(user, attribute)
        if new_value != old_value:
            self.stderr.write(
                _('Setting {attribute} for user "{username}" to "{new_value}"').format(
                    attribute=attribute, username=user.username, new_value=new_value
                )
            )
            setattr(user, attribute, new_value)
736543
public void updateResourcePermissions()
    {
        UserPermission recUserPermission = new UserPermission(this.getOwner().findRecordOwner());
        
        recUserPermission.addListener(new SubFileFilter(this.getOwner()));
        
        try {
            while (recUserPermission.hasNext())
            {
                recUserPermission.next();
                recUserPermission.edit();
                recUserPermission.getField(UserPermission.USER_RESOURCE_ID).setModified(true);   // Fake a mod, so the group permissions will be updated
                recUserPermission.set();
            }
        } catch (DBException ex) {
            ex.printStackTrace();
        }
        
        recUserPermission.free();
    }
559577
def update_user(self):
        
        # First create a copy of the current user
        user_dict = self.serialize()
        # Then delete the entities in the description field
        del user_dict['description']['entities']
        # Then upload user_dict
        user, meta = self._api.update_user('me', data=user_dict)
1352804
def update(self, name, modifiers):
        """"""
        self.update_name(name)
        self.modifiers = modifiers