protected CmsObject getCmsObject(CmsCmisCallContext context) {

        try {
            if (context.getUsername() == null) {
                // user name can be null
                CmsObject cms = OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest());
                cms.getRequestContext().setCurrentProject(m_adminCms.getRequestContext().getCurrentProject());
                return cms;
            } else {
                CmsObject cms = OpenCms.initCmsObject(m_adminCms);
                CmsProject projectBeforeLogin = cms.getRequestContext().getCurrentProject();
                cms.loginUser(context.getUsername(), context.getPassword());
                cms.getRequestContext().setCurrentProject(projectBeforeLogin);
                return cms;
            }
        } catch (CmsException e) {
            throw new CmisPermissionDeniedException(e.getLocalizedMessage(), e);

        }
    }
protected CmsObject getCmsObject ( CmsCmisCallContext context ) { try { if ( context . getUsername ( ) == null ) { CmsObject cms = OpenCms . initCmsObject ( OpenCms . getDefaultUsers ( ) . getUserGuest ( ) ) ; cms . getRequestContext ( ) . setCurrentProject ( m_adminCms . getRequestContext ( ) . getCurrentProject ( ) ) ; return cms ; } else { CmsObject cms = OpenCms . initCmsObject ( m_adminCms ) ; CmsProject projectBeforeLogin = cms . getRequestContext ( ) . getCurrentProject ( ) ; cms . loginUser ( context . getUsername ( ) , context . getPassword ( ) ) ; cms . getRequestContext ( ) . setCurrentProject ( projectBeforeLogin ) ; return cms ; } } catch ( CmsException e ) { throw new CmisPermissionDeniedException ( e . getLocalizedMessage ( ) , e ) ; } }
Initializes a CMS context for the authentication data contained in a call context.<p>

@param context the call context
@return the initialized CMS context