| | |
| | | import java.util.Map;
|
| | |
|
| | | import com.gitblit.GitBlitException.ForbiddenException;
|
| | | import com.gitblit.GitBlitException.NotAllowedException;
|
| | | import com.gitblit.GitBlitException.UnauthorizedException;
|
| | | import com.gitblit.GitBlitException.UnknownRequestException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.FederationModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | |
| | | public final String account;
|
| | |
|
| | | private final char[] password;
|
| | | |
| | |
|
| | | private volatile boolean allowManagement;
|
| | |
|
| | | private volatile boolean allowAdministration;
|
| | |
| | |
|
| | | try {
|
| | | refreshUsers();
|
| | | refreshSettings();
|
| | | allowManagement = true;
|
| | | } catch (UnauthorizedException e) {
|
| | | } catch (ForbiddenException e) {
|
| | | } catch (NotAllowedException e) {
|
| | | } catch (UnknownRequestException e) {
|
| | | } catch (IOException e) {
|
| | | System.err.println(e.getMessage());
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | settings = RpcUtils.getSettings(url, account, password);
|
| | | status = RpcUtils.getStatus(url, account, password);
|
| | | refreshStatus();
|
| | | allowAdministration = true;
|
| | | } catch (UnauthorizedException e) {
|
| | | } catch (ForbiddenException e) {
|
| | | } catch (NotAllowedException e) {
|
| | | } catch (UnknownRequestException e) {
|
| | | } catch (IOException e) {
|
| | | System.err.println(e.getMessage());
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public boolean allowManagement() {
|
| | | return allowManagement;
|
| | | }
|
| | | |
| | |
|
| | | public boolean allowAdministration() {
|
| | | return allowAdministration;
|
| | | }
|
| | |
| | | allUsers.clear();
|
| | | allUsers.addAll(users);
|
| | | return allUsers;
|
| | | }
|
| | |
|
| | | public ServerSettings refreshSettings() throws IOException {
|
| | | settings = RpcUtils.getSettings(url, account, password);
|
| | | return settings;
|
| | | }
|
| | |
|
| | | public ServerStatus refreshStatus() throws IOException {
|
| | | status = RpcUtils.getStatus(url, account, password);
|
| | | return status;
|
| | | }
|
| | |
|
| | | public List<FederationModel> refreshFederationRegistrations() throws IOException {
|
| | |
| | | public boolean deleteUser(UserModel user) throws IOException {
|
| | | return RpcUtils.deleteUser(user, url, account, password);
|
| | | }
|
| | |
|
| | | public boolean updateSettings(Map<String, String> newSettings) throws IOException {
|
| | | return RpcUtils.updateSettings(newSettings, url, account, password);
|
| | | }
|
| | | }
|