Package org.wso2.carbon.user.api

Examples of org.wso2.carbon.user.api.AuthorizationManager


    }

    public byte[] getProcessImage(String processId) {

        QName qName = decode(processId);
        SVGInterface svg = createSVG(qName);
        return svg.toPNGBytes();
    }
View Full Code Here


    private SVGInterface createSVG(QName qName) {

        // generate new
        InputStream in = getBpelDescriptor(qName);

        SVGInterface svg = null;

        try {
            svg = BPEL2SVGUtil.generate(in);

            if (svg == null)
View Full Code Here

   
    protected static SVGImpl generateSVGImpl(java.io.InputStream is) throws java.io.IOException {
      byte[] b=new byte[is.available()];
      is.read(b);
   
      BPELInterface bpel = new BPELImpl();
        OMElement bpelStr = bpel.load(new String(b));
       
        bpel.processBpelString(bpelStr);

        LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager();
        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

   * @param transformer The optional image transformer
   * @throws java.io.IOException Failed to generate the representation
   */
    public static void generate(java.io.InputStream is, java.io.OutputStream os,
                SVGImageTransformer transformer) throws java.io.IOException {
        SVGImpl svg = generateSVGImpl(is);
       
        if (transformer == null) {
          String str=svg.getHeaders()+svg.generateSVGString();
          os.write(str.getBytes());
        } else {
          transformer.transform(svg, os);
        }
    }
View Full Code Here

        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

     * @throws MessageBoxException if fails to check authorizations
     */
    public boolean isAuthorized(String messageBoxId, String operation) throws MessageBoxException {
        String loggedInUser = UserCoreUtil.getTenantLessUsername(CarbonContext.getCurrentContext().getUsername());
        try {
            AuthorizationManager authorizationManager = Utils.getUserRelam().getAuthorizationManager();

            String messageBoxPath = MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH + "/" +
                                    messageBoxId;

            return authorizationManager.isUserAuthorized(loggedInUser, messageBoxPath, operation);
        } catch (UserStoreException e) {
            String error = "Failed to check is " + loggedInUser + " authorized to " + operation +
                           " to " + messageBoxId;
            log.error(error);
            throw new MessageBoxException(error, e);
View Full Code Here

    }

    public boolean isUserAuthorized(String userName, String messageBoxId, String operation)
            throws MessageBoxException {
        try {
            AuthorizationManager authorizationManager = Utils.getUserRelam().getAuthorizationManager();

            String messageBoxPath = MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH + "/" +
                                    messageBoxId;

            return authorizationManager.isUserAuthorized(userName, messageBoxPath, operation);
        } catch (UserStoreException e) {
            String error = "Failed to check is " + userName + " authorized to " + operation +
                           " to " + messageBoxId;
            log.error(error);
            throw new MessageBoxException(error, e);
View Full Code Here

     * @throws MessageBoxException if failed to apply permissions
     */
    public void addPermission(String messageBoxId, PermissionLabel permissionLabel)
            throws MessageBoxException {
        try {
            AuthorizationManager authorizationManager = Utils.getUserRelam().getAuthorizationManager();

            String messageBoxPath = MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH + "/" +
                                    messageBoxId;

            for (String sharedUser : permissionLabel.getSharedUsers()) {
                for (String operation : permissionLabel.getOperations()) {
                    authorizationManager.authorizeUser(sharedUser, messageBoxPath, operation);
                }
            }
        } catch (UserStoreException e) {
            String error = "Failed to add permissions to " + messageBoxId + " with permission label "
                           + permissionLabel.getLabelName();
View Full Code Here

    }


    public void allowAllPermissionsToAdminRole(String messageBoxId) throws MessageBoxException {
        try {
            AuthorizationManager authorizationManager = Utils.getUserRelam().getAuthorizationManager();

            String messageBoxPath = MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH + "/" +
                                    messageBoxId;
            String adminRoleName = MessageBoxServiceValueHolder.getInstance().
                    getRealmService().getBootstrapRealmConfiguration().getAdminRoleName();
            authorizationManager.authorizeRole(adminRoleName, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_DELETE_MESSAGE);
            authorizationManager.authorizeRole(adminRoleName, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_CHANGE_MESSAGE_VISIBILITY);
            authorizationManager.authorizeRole(adminRoleName, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_GET_QUEUE_ATTRIBUTES);
            authorizationManager.authorizeRole(adminRoleName, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_RECEIVE_MESSAGE);
            authorizationManager.authorizeRole(adminRoleName, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_SEND_MESSAGE);

        } catch (UserStoreException e) {
            String error = "Failed to add permissions to admin role for message box " + messageBoxId;
            log.error(error);
View Full Code Here

     * @throws MessageBoxException - if fails to allow permissions
     */
    public void allowAllPermissionsToUser(String messageBoxId, String user)
            throws MessageBoxException {
        try {
            AuthorizationManager authorizationManager = Utils.getUserRelam().getAuthorizationManager();

            String messageBoxPath = MessageBoxConstants.MB_MESSAGE_BOX_STORAGE_PATH + "/" +
                                    messageBoxId;
            authorizationManager.authorizeUser(user, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_DELETE_MESSAGE);
            authorizationManager.authorizeUser(user, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_CHANGE_MESSAGE_VISIBILITY);
            authorizationManager.authorizeUser(user, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_GET_QUEUE_ATTRIBUTES);
            authorizationManager.authorizeUser(user, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_RECEIVE_MESSAGE);
            authorizationManager.authorizeUser(user, messageBoxPath,
                                               MessageBoxConstants.SQS_OPERATION_SEND_MESSAGE);

        } catch (UserStoreException e) {
            String error = "Failed to allow permissions to user " + user + " for message box " + messageBoxId;
            log.error(error);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.api.AuthorizationManager

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.