PUT /incline/users/1/demote
161053
def demote
      # remove the administrator flag from the selected user.
      if @user.system_admin?
        if @user.update(system_admin: false)
          flash[:success] = "User #{@user} has been demoted from administrator."
        else
          flash[:danger] = "Failed to demote user #{@user}."
        end
      else
        flash[:warning] = "User #{@user} is not an administrator."
        unless inline_request?
          redirect_to users_path and return
        end
      end

      if inline_request?
        render 'show', formats: [ :json ]
      else
        redirect_to users_path
      end

    end
87087
function deleteTempAndCallback(err) {
            if (validationResult.extractDir) {
                fs.remove(validationResult.extractDir);
                delete validationResult.extractDir;
            }
            callback(err, validationResult);
        }
249832
function composeAddRemoveGroupMember({ action="add", roles="members" }) {
  /**
   * Add/Remove user from group
   *
   * @param {String} username
   * @param {String} groupname
   * @param {Function} done - done(err)
   */
   return function(username, groupname, done) {
     return getGroup(groupname, function(getGroupErr, group) {
       if (getGroupErr) {
         return done(getGroupErr);
       }

       if (!group) {
         return done(new Error(`group '${groupname}' not found`));
       }

       return getUser(username, function(getUserErr, user) {
         if (getUserErr) {
           return done(getUserErr);
         }

         if (!user) {
           return done(new Error(`user '${username}' not found`));
         }

         group[roles][action](user.id);
         return group.save(done);
       });
     });
   };
}
1301200
def rm(self, path):
        """"""

        resp = self._sendRequest("DELETE", path)
        # By documentation server must return 200 "OK", but I get 204 "No Content".
        # Anyway file or directory have been removed.
        if not (resp.status_code in (200, 204)):
            raise YaDiskException(resp.status_code, resp.content)
43280
def downgrade():
    """"""
    # Remove 'created' and 'updated' columns
    op.drop_column('oauthclient_remoteaccount', 'created')
    op.drop_column('oauthclient_remoteaccount', 'updated')

    op.drop_column('oauthclient_remotetoken', 'created')
    op.drop_column('oauthclient_remotetoken', 'updated')

    op.drop_column('oauthclient_useridentity', 'created')
    op.drop_column('oauthclient_useridentity', 'updated')
151457
function performRemove() {
        UserService.remove(vm.user)
          .then(deleteUserSuccess)
          .catch(deleteUserCatch);

        function deleteUserSuccess() {
          Toast.show({type: 'success', text: 'User ' + vm.displayName + ' deleted'});
          vm.showList();
        }

        function deleteUserCatch(err) {
          Toast.show({
            type: 'warn',
            text: 'Error while deleting user ' + vm.displayName,
            link: {state: $state.$current, params: $stateParams}
          });

          if (form && err) {
            form.setResponseErrors(err, vm.errors);
          }
        }
      }
975362
def destroy
      membership = current_user.memberships.find_by(id: params[:id])
      group = membership.group

      Group::Services::Leave.new(group: group, person: current_user).call

      redirect_to group
    end
464081
def update(self, resource, rid, updates):
        
        if resource[-1] != '/':
            resource += '/'
        resource += str(rid)
        return self.put(resource, data=updates)
984783
def migrate_down!(level = nil)
      migrations.sort.reverse.each do |migration|
        if level.nil?
          migration.perform_down()
        else
          migration.perform_down() if migration.position > level.to_i
        end
      end
    end
515786
def do_rm(self, subcmd, opts, message):
        
        maildir = self.maildir
        client = MdClient(maildir, filesystem=self.filesystem)
        try:
            client.remove(message)
        except KeyError:
            return 1
1136707
def demote_admin(self, group_jid, peer_jid):
        
        log.info("[+] Demoting user {} to a regular member in group {}".format(peer_jid, group_jid))
        return self._send_xmpp_element(group_adminship.DemoteAdminRequest(group_jid, peer_jid))
420381
def revert(candidate_id, member_id)
      post_request("candidates/#{candidate_id}/revert") do |request|
        request.body = { member_id: member_id }.to_json
      end
    end
109352
function pushEdit (edits, item, added, removed) {
  var last = edits[edits.length - 1]

  if (last && last.added === added && last.removed === removed) {
    last.items.unshift(item) // Not push: edits get reversed later
  } else {
    edits.push({
      items: [item],
      added: added,
      removed: removed
    })
  }
}
210472
function like_a_boss(attempt) {
    fs.rename(from, to, function(err) {
      if (err) log('Error when moving directory: ' + err.message);

      // if no error, or err is not EPERM/EACCES, we're done
      if (!err || (err.code != 'EPERM' && err.code != 'EACCES'))
        cb();
      else if (attempt >= 30) // max attempts reached, so give up.
        cb(err);
      else
        setTimeout(function() { like_a_boss(attempt + 1) }, 1000);

    })
  }
931807
def purge(root=os.path.join(base.data_dir(), 'models')):
    
    """
    root = os.path.expanduser(root)
    files = os.listdir(root)
    for f in files:
        if f.endswith(".params"):
            os.remove(os.path.join(root, f))
971754
public function down()
    {
        PermissionsManager::deleteRole('admin', 'Administrator');
        PermissionsManager::deleteRole('user', 'User');
        PermissionsManager::deleteRole('banned', 'Banned user');

        PermissionsManager::deletePermission('login', 'Allow login');
        PermissionsManager::deletePermission('panel', 'Allow access to admin panel');
    }
1239530
def user_delete(attribs, dir_info)
      attribs = user_record_name_alternatives(attribs)

      check_critical_attribute( attribs, :record_name )
      attribs    = tidy_attribs(attribs)

      command    = {action: 'delete', scope: 'Users', value: nil, attribute: nil}
      user_attrs = attribs.merge(command)

      dscl( user_attrs, dir_info )
    end