use of org.apache.openmeetings.db.entity.user.User.Right in project openmeetings by apache.
the class UserForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(password.setResetPassword(false).setLabel(Model.of(getString("110"))).setRequired(false).add(passValidator = new StrongPasswordValidator(getMinPasswdLength(cfgDao), getModelObject())));
login.setLabel(Model.of(getString("108")));
add(login.add(minimumLength(getMinLoginLength(cfgDao))));
add(new DropDownChoice<>("type", Arrays.asList(Type.values())).add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateDomain(target);
}
}));
update(null);
add(domain.add(domainId).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true));
add(new Label("ownerId"));
add(new DateLabel("inserted"));
add(new DateLabel("updated"));
add(new CheckBox("forceTimeZoneCheck"));
add(new Select2MultiChoice<>("rights", null, new RestrictiveChoiceProvider<Right>() {
private static final long serialVersionUID = 1L;
@Override
public String getDisplayValue(Right choice) {
return choice.name();
}
@Override
public String toId(Right choice) {
return choice.name();
}
@Override
public void query(String term, int page, Response<Right> response) {
boolean isGroupAdmin = hasGroupAdminLevel(getRights());
for (Right r : Right.values()) {
if (Right.GroupAdmin == r) {
continue;
}
if (isGroupAdmin && (Right.Admin == r || Right.Soap == r)) {
continue;
}
if (Strings.isEmpty(term) || r.name().contains(term)) {
response.add(r);
}
}
}
@Override
public Right fromId(String id) {
return Right.valueOf(id);
}
}));
add(new ComunityUserForm("comunity", getModel()));
// attach an ajax validation behavior to all form component's keydown
// event and throttle it down to once per second
add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND));
add(adminPass);
}
use of org.apache.openmeetings.db.entity.user.User.Right in project openmeetings by apache.
the class MainPanel method getMainMenu.
private List<IMenuItem> getMainMenu() {
List<IMenuItem> mmenu = new ArrayList<>();
{
// Dashboard Menu Points
List<IMenuItem> l = new ArrayList<>();
l.add(getSubItem("290", "1450", MenuActions.dashboardModuleStartScreen, null));
l.add(getSubItem("291", "1451", MenuActions.dashboardModuleCalendar, null));
mmenu.add(new OmMenuItem(getString("124"), l));
}
{
// Conference Menu Points
List<IMenuItem> l = new ArrayList<>();
l.add(getSubItem("777", "1506", MenuActions.conferenceModuleRoomList, MenuParams.publicTabButton));
l.add(getSubItem("779", "1507", MenuActions.conferenceModuleRoomList, MenuParams.privateTabButton));
if (cfgDao.getBool(CONFIG_MYROOMS_ENABLED, true)) {
l.add(getSubItem("781", "1508", MenuActions.conferenceModuleRoomList, MenuParams.myTabButton));
}
List<Room> recent = roomDao.getRecent(getUserId());
if (!recent.isEmpty()) {
l.add(new OmMenuItem(DELIMITER, (String) null));
}
for (Room r : recent) {
final Long roomId = r.getId();
l.add(new OmMenuItem(r.getName(), r.getName()) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
RoomEnterBehavior.roomEnter((MainPage) getPage(), target, roomId);
}
});
}
mmenu.add(new OmMenuItem(getString("792"), l));
}
{
// Recording Menu Points
List<IMenuItem> l = new ArrayList<>();
l.add(getSubItem("395", "1452", MenuActions.recordModule, null));
mmenu.add(new OmMenuItem(getString("395"), l));
}
Set<Right> r = WebSession.getRights();
boolean isAdmin = hasAdminLevel(r);
if (isAdmin || hasGroupAdminLevel(r)) {
// Administration Menu Points
List<IMenuItem> l = new ArrayList<>();
l.add(getSubItem("125", "1454", MenuActions.adminModuleUser, null));
if (isAdmin) {
l.add(getSubItem("597", "1455", MenuActions.adminModuleConnections, null));
}
l.add(getSubItem("126", "1456", MenuActions.adminModuleOrg, null));
l.add(getSubItem("186", "1457", MenuActions.adminModuleRoom, null));
if (isAdmin) {
l.add(getSubItem("263", "1458", MenuActions.adminModuleConfiguration, null));
l.add(getSubItem("348", "1459", MenuActions.adminModuleLanguages, null));
l.add(getSubItem("1103", "1454", MenuActions.adminModuleLDAP, null));
l.add(getSubItem("1571", "1572", MenuActions.adminModuleOAuth, null));
l.add(getSubItem("367", "1461", MenuActions.adminModuleBackup, null));
l.add(getSubItem("main.menu.admin.email", "main.menu.admin.email.desc", MenuActions.adminModuleEmail, null));
}
mmenu.add(new OmMenuItem(getString("6"), l));
}
return mmenu;
}
use of org.apache.openmeetings.db.entity.user.User.Right in project openmeetings by apache.
the class UserDao method getRights.
public Set<Right> getRights(Long id) {
Set<Right> rights = new HashSet<>();
if (id == null) {
return rights;
}
// For direct access of linked users
if (id.longValue() < 0) {
rights.add(Right.Room);
return rights;
}
User u = get(id);
if (u != null) {
return u.getRights();
}
return rights;
}
use of org.apache.openmeetings.db.entity.user.User.Right in project openmeetings by apache.
the class WebSession method invalidate.
@Override
public void invalidate() {
cm.invalidate(userId, getId());
super.invalidate();
userId = null;
rights = Collections.unmodifiableSet(Collections.<Right>emptySet());
ISO8601FORMAT = null;
sdf = null;
languageId = -1;
i = null;
soap = null;
roomId = null;
recordingId = null;
externalType = null;
tz = null;
browserTz = null;
extProps = new ExtendedClientProperties();
}
use of org.apache.openmeetings.db.entity.user.User.Right in project openmeetings by apache.
the class WebSession method setUser.
private void setUser(User u, Set<Right> rights) {
Long _recordingId = recordingId;
Long _roomId = roomId;
Invitation _i = i;
SOAPLogin _soap = soap;
ClientInfo _info = clientInfo;
ExtendedClientProperties _extProps = extProps;
// required to prevent session fixation
replaceSession();
if (_recordingId != null) {
recordingId = _recordingId;
}
if (_roomId != null) {
roomId = _roomId;
}
if (_i != null) {
i = _i;
}
if (_soap != null) {
soap = _soap;
}
if (_info != null) {
clientInfo = _info;
}
if (_extProps != null) {
extProps = _extProps;
}
userId = u.getId();
if (rights == null || rights.isEmpty()) {
Set<Right> r = new HashSet<>(u.getRights());
if (u.getGroupUsers() != null && !AuthLevelUtil.hasAdminLevel(r)) {
for (GroupUser gu : u.getGroupUsers()) {
if (gu.isModerator()) {
r.add(Right.GroupAdmin);
break;
}
}
}
this.rights = Collections.unmodifiableSet(r);
} else {
this.rights = Collections.unmodifiableSet(rights);
}
languageId = u.getLanguageId();
externalType = u.getExternalType();
tz = getTimeZone(u);
ISO8601FORMAT = FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
setLocale(LocaleHelper.getLocale(u));
sdf = FormatHelper.getDateTimeFormat(u);
}
Aggregations