use of cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin in project perun by CESNET.
the class GroupManagersTabItem method fillContentGroups.
private Widget fillContentGroups(final GetAdminGroups admins, TabMenu menu) {
admins.clearTableSelectedSet();
boolean isMembersGroup = group.isCoreGroup();
menu.addWidget(0, UiElements.getRefreshButton(this));
// Events for reloading when finished
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(admins);
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerGroupFromGroup());
if (!isMembersGroup) {
CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerGroupToGroup(), new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new AddGroupManagerGroupTabItem(group, events), true);
}
});
if (!session.isVoAdmin(group.getVoId()) && !session.isGroupAdmin(group.getId()))
addButton.setEnabled(false);
menu.addWidget(1, addButton);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final ArrayList<Group> itemsToRemove = admins.getTableSelectedList();
String text = "Members of following groups won't be group managers anymore.";
UiElements.showDeleteConfirm(itemsToRemove, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
// TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
for (int i = 0; i < itemsToRemove.size(); i++) {
RemoveAdmin request;
if (i == itemsToRemove.size() - 1) {
request = new RemoveAdmin(PerunEntity.GROUP, JsonCallbackEvents.disableButtonEvents(removeButton, events));
} else {
request = new RemoveAdmin(PerunEntity.GROUP, JsonCallbackEvents.disableButtonEvents(removeButton));
}
request.removeGroupAdminGroup(group, itemsToRemove.get(i));
}
}
});
}
});
menu.addWidget(2, removeButton);
} else {
// is core group
menu.addWidget(1, new Image(SmallIcons.INSTANCE.helpIcon()));
Anchor a = new Anchor("<strong>To edit VO managers use VO manager section in menu.</strong>", true);
a.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
session.getTabManager().addTab(new VoManagersTabItem(group.getVoId()));
}
});
menu.addWidget(2, a);
}
// get the table
CellTable<Group> table = admins.getTable(new FieldUpdater<Group, String>() {
public void update(int i, Group grp, String s) {
session.getTabManager().addTab(new GroupDetailTabItem(grp));
}
});
removeButton.setEnabled(false);
if (session.isVoAdmin(group.getVoId()) || session.isGroupAdmin(group.getId())) {
JsonUtils.addTableManagedButton(admins, table, removeButton);
}
table.setStyleName("perun-table");
return table;
}
use of cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin in project perun by CESNET.
the class GroupManagersTabItem method fillContentUsers.
private Widget fillContentUsers(final GetRichAdminsWithAttributes admins, TabMenu menu) {
admins.clearTableSelectedSet();
boolean isMembersGroup = group.isCoreGroup();
menu.addWidget(0, UiElements.getRefreshButton(this));
// Events for reloading when finished
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(admins);
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerFromGroup());
if (!isMembersGroup) {
CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerToGroup(), new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new AddGroupManagerTabItem(group), true);
}
});
if (!session.isVoAdmin(group.getVoId()) && !session.isGroupAdmin(group.getId()))
addButton.setEnabled(false);
menu.addWidget(1, addButton);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final ArrayList<User> itemsToRemove = admins.getTableSelectedList();
String text = "Following users won't be group managers anymore.";
UiElements.showDeleteConfirm(itemsToRemove, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
// TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
for (int i = 0; i < itemsToRemove.size(); i++) {
RemoveAdmin request;
if (i == itemsToRemove.size() - 1) {
request = new RemoveAdmin(PerunEntity.GROUP, JsonCallbackEvents.disableButtonEvents(removeButton, events));
} else {
request = new RemoveAdmin(PerunEntity.GROUP, JsonCallbackEvents.disableButtonEvents(removeButton));
}
request.removeGroupAdmin(group, itemsToRemove.get(i));
}
}
});
}
});
menu.addWidget(2, removeButton);
} else {
// is core group
menu.addWidget(1, new Image(SmallIcons.INSTANCE.helpIcon()));
Anchor a = new Anchor("<strong>To edit VO managers use VO manager section in menu.</strong>", true);
a.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
session.getTabManager().addTab(new VoManagersTabItem(group.getVoId()));
}
});
menu.addWidget(2, a);
}
// get the table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = admins.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new UserDetailTabItem(user));
}
});
} else {
table = admins.getTable();
}
removeButton.setEnabled(false);
if (session.isVoAdmin(group.getVoId()) || session.isGroupAdmin(group.getId())) {
JsonUtils.addTableManagedButton(admins, table, removeButton);
}
table.setStyleName("perun-table");
return table;
}
use of cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin in project perun by CESNET.
the class VoManagersTabItem method fillContentUsers.
private Widget fillContentUsers(final GetRichAdminsWithAttributes admins, TabMenu menu) {
admins.clearTableSelectedSet();
// refresh
menu.addWidget(0, UiElements.getRefreshButton(this));
// Events for reloading when finished
final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(admins);
CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerToVo(), new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new AddVoManagerTabItem(vo), true);
}
});
if (!session.isVoAdmin(voId))
addButton.setEnabled(false);
menu.addWidget(1, addButton);
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerFromVo());
menu.addWidget(2, removeButton);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final ArrayList<User> adminsForRemoving = admins.getTableSelectedList();
String text = "Following users won't be VO managers anymore.";
UiElements.showDeleteConfirm(adminsForRemoving, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
// TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
for (int i = 0; i < adminsForRemoving.size(); i++) {
RemoveAdmin request;
if (i == adminsForRemoving.size() - 1) {
request = new RemoveAdmin(PerunEntity.VIRTUAL_ORGANIZATION, JsonCallbackEvents.disableButtonEvents(removeButton, events));
} else {
request = new RemoveAdmin(PerunEntity.VIRTUAL_ORGANIZATION, JsonCallbackEvents.disableButtonEvents(removeButton));
}
request.removeVoAdmin(vo, adminsForRemoving.get(i));
}
}
});
}
});
// get the table
CellTable<User> table;
if (session.isPerunAdmin()) {
table = admins.getTable(new FieldUpdater<User, String>() {
public void update(int i, User user, String s) {
session.getTabManager().addTab(new UserDetailTabItem(user));
}
});
} else {
table = admins.getTable();
}
// add a class to the table and wrap it into scroll panel
table.addStyleName("perun-table");
removeButton.setEnabled(false);
if (session.isVoAdmin(voId))
JsonUtils.addTableManagedButton(admins, table, removeButton);
return table;
}
use of cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin in project perun by CESNET.
the class CreateFacilityTabItem method fillContentGroups.
private Widget fillContentGroups(final GetAdminGroups jsonCallback, TabMenu menu) {
jsonCallback.clearTableSelectedSet();
// get the table
CellTable<Group> table = jsonCallback.getTable(new FieldUpdater<Group, String>() {
@Override
public void update(int i, Group grp, String s) {
session.getTabManager().addTab(new GroupDetailTabItem(grp));
}
});
menu.addWidget(0, TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerGroupToFacility(), new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new AddFacilityManagerGroupTabItem(facility, JsonCallbackEvents.refreshTableEvents(jsonCallback)), true);
}
}));
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerGroupFromFacility());
menu.addWidget(1, removeButton);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final ArrayList<Group> list = jsonCallback.getTableSelectedList();
String text = "Members of following groups won't be facility managers anymore and won't be able to manage this facility in Perun.";
UiElements.showDeleteConfirm(list, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
// TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton, JsonCallbackEvents.refreshTableEvents(jsonCallback)));
request.removeFacilityAdminGroup(facility, list.get(i));
} else {
RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton));
request.removeFacilityAdminGroup(facility, list.get(i));
}
}
}
});
}
});
removeButton.setEnabled(false);
JsonUtils.addTableManagedButton(jsonCallback, table, removeButton);
table.addStyleName("perun-table");
return table;
}
use of cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin in project perun by CESNET.
the class FacilityManagersTabItem method fillContentGroups.
private Widget fillContentGroups(final GetAdminGroups jsonCallback, TabMenu menu) {
jsonCallback.clearTableSelectedSet();
// get the table
CellTable<Group> table = jsonCallback.getTable(new FieldUpdater<Group, String>() {
@Override
public void update(int i, Group grp, String s) {
session.getTabManager().addTab(new GroupDetailTabItem(grp));
}
});
menu.addWidget(0, UiElements.getRefreshButton(this));
menu.addWidget(1, TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addManagerGroupToFacility(), new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new AddFacilityManagerGroupTabItem(facility, JsonCallbackEvents.refreshTableEvents(jsonCallback)), true);
}
}));
final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeManagerGroupFromFacility());
menu.addWidget(2, removeButton);
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final ArrayList<Group> list = jsonCallback.getTableSelectedList();
String text = "Members of following groups won't be facility managers anymore and won't be able to manage this facility in Perun.";
UiElements.showDeleteConfirm(list, text, new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
// TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE !!
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton, JsonCallbackEvents.refreshTableEvents(jsonCallback)));
request.removeFacilityAdminGroup(facility, list.get(i));
} else {
RemoveAdmin request = new RemoveAdmin(PerunEntity.FACILITY, JsonCallbackEvents.disableButtonEvents(removeButton));
request.removeFacilityAdminGroup(facility, list.get(i));
}
}
}
});
}
});
removeButton.setEnabled(false);
JsonUtils.addTableManagedButton(jsonCallback, table, removeButton);
table.addStyleName("perun-table");
return table;
}
Aggregations