Package org.jdesktop.wonderland.modules.security.common

Examples of org.jdesktop.wonderland.modules.security.common.SecurityComponentServerState


    }

    @Override
    public CellComponentServerState getServerState(CellComponentServerState state) {
        if (state == null) {
            state = new SecurityComponentServerState();
        }

        SecurityComponentServerState scss = (SecurityComponentServerState) state;
        scss.setPermissions(getCellPermissions());
        return super.getServerState(state);
    }
View Full Code Here


    @Override
    public void setServerState(CellComponentServerState state) {
        super.setServerState(state);

        SecurityComponentServerState scss = (SecurityComponentServerState) state;

        // make sure this user is an owner, and therefore has permission
        // to set the server state of this component.  Note we don't
        // check the user if their ID is null (that means it is the system
        // doing the setting) or if there are no owners.
        ClientIdentityManager cim = AppContext.getManager(ClientIdentityManager.class);
        WonderlandIdentity id = cim.getClientID();
        if (id != null && owners != null && !owners.isEmpty()) {
            // make a request to set the permissions if this is an owner
            Resource ownerRsrc = new OwnerResource(cellRef.get().getCellID().toString(),
                                                   owners);
            ActionMap am = new ActionMap(ownerRsrc, new OwnerAction());
            ResourceMap rm = new ResourceMap();
            rm.put(ownerRsrc.getId(), am);

            SecurityManager sec = AppContext.getManager(SecurityManager.class);
            SecureTask sst = new SetStateTask(id.getUsername(), ownerRsrc.getId(),
                                              this, scss.getPermissions());
            sec.doSecure(rm, sst);
        } else {
            // no security check, just set the values
            setCellPermissions(scss.getPermissions());
        }
    }
View Full Code Here

        return BUNDLE.getString("Security");
    }

    public <T extends CellComponentServerState> T
            getDefaultCellComponentServerState() {
        SecurityComponentServerState state = new SecurityComponentServerState();

        CellPermissions perms = new CellPermissions();

        // add the current user as an owner
        ServerSessionManager primarySM = LoginManager.getPrimary();
        if (primarySM != null) {
            WonderlandSession primarySession = primarySM.getPrimarySession();
            if (primarySession != null) {
                Principal owner = new Principal(
                        primarySession.getUserID().getUsername(),
                        Principal.Type.USER);
                perms.getOwners().add(owner);
            }
        }

        // add view permissions for all users
        Principal p = new Principal("users", Principal.Type.EVERYBODY);
        ActionDTO view = new ActionDTO(new ViewAction());
        perms.getPermissions().add(new Permission(
                p, view, Permission.Access.GRANT));
        ActionDTO modify = new ActionDTO(new ModifyAction());
        perms.getPermissions().add(new Permission(
                p, modify, Permission.Access.DENY));

        state.setPermissions(perms);
        return (T) state;
    }
View Full Code Here

    /**
     * @inheritDoc()
     */
    public void open() {
        CellServerState cellServerState = editor.getCellServerState();
        SecurityComponentServerState state =
                (SecurityComponentServerState) cellServerState.getComponentServerState(
                SecurityComponentServerState.class);

        // set the lists up based on the model
        originalCellPermissions = state.getPermissions();
        perms.fromPermissions(originalCellPermissions);
        permsTable.repaint();
    }
View Full Code Here

     */
    public void apply() {
        // Figure out whether there already exists a server state for the
        // component.
        CellServerState cellServerState = editor.getCellServerState();
        SecurityComponentServerState state =
                (SecurityComponentServerState) cellServerState.getComponentServerState(
                SecurityComponentServerState.class);
        if (state == null) {
            state = new SecurityComponentServerState();
        }

        // Update the permissions state and add to the update list
        CellPermissions out = perms.toPermissions();
        state.setPermissions(out);
        editor.addToUpdateList(state);
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.security.common.SecurityComponentServerState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.