Source:
<code>public void executeUpgrade() throws DotDataException, DotRuntimeException { Logger.debug(this, "Upgrading Front-end and Back-End roles definition."); try { DbConnectionFactory.getConnection().setAutoCommit(true); } catch (SQLException e) { throw new DotDataException(e.getMessage(), e); } final DotConnect dotConnect = new DotConnect(); dotConnect.setSQL(FRONTEND_ROLE_SANITY_CHECK); final int count = dotConnect.getInt("c"); if(count > 0){ throw new DotDataException( String.format("The front-end Role defined as `LoggedIn Site User` has %d layouts associated. This must be corrected manually before this upgrade task can run.", count) ); } if (DbConnectionFactory.isPostgres()) { dotConnect.setSQL(POSTGRES_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(POSTGRES_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isOracle()) { dotConnect.setSQL(ORACLE_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(ORACLE_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isMsSql()) { dotConnect.setSQL(MSSQL_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(MSSQL_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isMySql()) { dotConnect.setSQL(MYSQL_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(MYSQL_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } <START> <END> }</code><technical_language>I need a startup task finds users a layout assign DOTCMS_BACK_END_USER role (unless I missed it)</technical_language>

Target:
public void executeUpgrade() throws DotDataException, DotRuntimeException { Logger.debug(this, "Upgrading Front-end and Back-End roles definition."); try { DbConnectionFactory.getConnection().setAutoCommit(true); } catch (SQLException e) { throw new DotDataException(e.getMessage(), e); } final DotConnect dotConnect = new DotConnect(); dotConnect.setSQL(FRONTEND_ROLE_SANITY_CHECK); final int count = dotConnect.getInt("c"); if(count > 0){ throw new DotDataException( String.format("The front-end Role defined as `LoggedIn Site User` has %d layouts associated. This must be corrected manually before this upgrade task can run.", count) ); } if (DbConnectionFactory.isPostgres()) { dotConnect.setSQL(POSTGRES_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(POSTGRES_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isOracle()) { dotConnect.setSQL(ORACLE_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(ORACLE_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isMsSql()) { dotConnect.setSQL(MSSQL_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(MSSQL_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } if (DbConnectionFactory.isMySql()) { dotConnect.setSQL(MYSQL_RENAME_ROLE_KEY_FRONT_END_USER); dotConnect.loadResult(); dotConnect.setSQL(MYSQL_RENAME_ROLE_KEY_BACK_END_USER); dotConnect.loadResult(); } final List<Map> users = loadUsersWithLayoutButNotBackendRole(dotConnect); addBackendRole(users, dotConnect); }