Search in sources :

Example 1 with Right

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);
}
Also used : RestrictiveChoiceProvider(org.apache.openmeetings.web.util.RestrictiveChoiceProvider) Label(org.apache.wicket.markup.html.basic.Label) DateLabel(org.apache.openmeetings.web.util.DateLabel) Right(org.apache.openmeetings.db.entity.user.User.Right) AjaxFormValidatingBehavior(org.apache.wicket.ajax.form.AjaxFormValidatingBehavior) StrongPasswordValidator(org.apache.openmeetings.core.util.StrongPasswordValidator) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) DateLabel(org.apache.openmeetings.web.util.DateLabel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Response(org.wicketstuff.select2.Response) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) CheckBox(org.apache.wicket.markup.html.form.CheckBox) ComunityUserForm(org.apache.openmeetings.web.common.ComunityUserForm)

Example 2 with Right

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;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OmMenuItem(org.apache.openmeetings.web.common.menu.OmMenuItem) IMenuItem(com.googlecode.wicket.jquery.ui.widget.menu.IMenuItem) ArrayList(java.util.ArrayList) Right(org.apache.openmeetings.db.entity.user.User.Right) List(java.util.List) ArrayList(java.util.ArrayList) Room(org.apache.openmeetings.db.entity.room.Room)

Example 3 with Right

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;
}
Also used : User(org.apache.openmeetings.db.entity.user.User) Right(org.apache.openmeetings.db.entity.user.User.Right) HashSet(java.util.HashSet)

Example 4 with Right

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();
}
Also used : Right(org.apache.openmeetings.db.entity.user.User.Right) ExtendedClientProperties(org.apache.openmeetings.web.util.ExtendedClientProperties)

Example 5 with Right

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);
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) SOAPLogin(org.apache.openmeetings.db.entity.server.SOAPLogin) Invitation(org.apache.openmeetings.db.entity.room.Invitation) Right(org.apache.openmeetings.db.entity.user.User.Right) ClientInfo(org.apache.wicket.core.request.ClientInfo) ExtendedClientProperties(org.apache.openmeetings.web.util.ExtendedClientProperties) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

Right (org.apache.openmeetings.db.entity.user.User.Right)6 HashSet (java.util.HashSet)2 ExtendedClientProperties (org.apache.openmeetings.web.util.ExtendedClientProperties)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 IMenuItem (com.googlecode.wicket.jquery.ui.widget.menu.IMenuItem)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 List (java.util.List)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 StrongPasswordValidator (org.apache.openmeetings.core.util.StrongPasswordValidator)1 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)1 FileItem (org.apache.openmeetings.db.entity.file.FileItem)1 Invitation (org.apache.openmeetings.db.entity.room.Invitation)1 Room (org.apache.openmeetings.db.entity.room.Room)1 SOAPLogin (org.apache.openmeetings.db.entity.server.SOAPLogin)1 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)1 User (org.apache.openmeetings.db.entity.user.User)1 ComunityUserForm (org.apache.openmeetings.web.common.ComunityUserForm)1 OmMenuItem (org.apache.openmeetings.web.common.menu.OmMenuItem)1