public void setPassword(CmsRequestContext context, String username, String newPassword)
    throws CmsException, CmsRoleViolationException {

        CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
        try {
            CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(username));
            checkRoleForUserModification(dbc, username, role);
            m_driverManager.setPassword(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), newPassword);
        } catch (Exception e) {
            dbc.report(null, Messages.get().container(Messages.ERR_SET_PASSWORD_1, username), e);
        } finally {
            dbc.clear();
        }
    }
public void setPassword ( CmsRequestContext context , String username , String newPassword ) throws CmsException , CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { CmsRole role = CmsRole . ACCOUNT_MANAGER . forOrgUnit ( getParentOrganizationalUnit ( username ) ) ; checkRoleForUserModification ( dbc , username , role ) ; m_driverManager . setPassword ( dbc , CmsOrganizationalUnit . removeLeadingSeparator ( username ) , newPassword ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_SET_PASSWORD_1 , username ) , e ) ; } finally { dbc . clear ( ) ; } }
Sets the password for a user.<p>

@param context the current request context
@param username the name of the user
@param newPassword the new password

@throws CmsException if operation was not successful
@throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}