mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #1071 from sharelatex/sk-enable-git-bridge-in-v2
Enable git-bridge in v2 GitOrigin-RevId: 24586c7c80b53ae171199ecde538df794f78ecc7
This commit is contained in:
parent
6cd35d66d5
commit
81b09c7800
10 changed files with 68 additions and 1 deletions
|
@ -369,6 +369,8 @@ module.exports = ProjectController =
|
|||
showTestControls: req.query?.tc == 'true' || user.isAdmin
|
||||
brandVariation: brandVariation
|
||||
allowedImageNames: Settings.allowedImageNames || []
|
||||
gitBridgePublicBaseUrl: Settings.gitBridgePublicBaseUrl
|
||||
showGitBridge: req.query?.gitbridge == 'true' || user.isAdmin
|
||||
timer.done()
|
||||
|
||||
_buildProjectList: (allProjects, v1Projects = [])->
|
||||
|
|
|
@ -12,6 +12,8 @@ module.exports = Features =
|
|||
return not Features.externalAuthenticationSystemUsed() or Settings.overleaf?
|
||||
when 'github-sync'
|
||||
return Settings.enableGithubSync
|
||||
when 'git-bridge'
|
||||
return Settings.enableGitBridge
|
||||
when 'v1-return-message'
|
||||
return Settings.accountMerge? and Settings.overleaf?
|
||||
when 'custom-togglers'
|
||||
|
|
|
@ -43,6 +43,7 @@ UserSchema = new Schema
|
|||
versioning: { type:Boolean, default: Settings.defaultFeatures.versioning }
|
||||
dropbox: { type:Boolean, default: Settings.defaultFeatures.dropbox }
|
||||
github: { type:Boolean, default: Settings.defaultFeatures.github }
|
||||
gitBridge: { type:Boolean, default: Settings.defaultFeatures.gitBridge }
|
||||
compileTimeout: { type:Number, default: Settings.defaultFeatures.compileTimeout }
|
||||
compileGroup: { type:String, default: Settings.defaultFeatures.compileGroup }
|
||||
templates: { type:Boolean, default: Settings.defaultFeatures.templates }
|
||||
|
|
|
@ -135,6 +135,7 @@ block requirejs
|
|||
window.trackChangesState = data.trackChangesState;
|
||||
window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
|
||||
window.richTextEnabled = #{richTextEnabled}
|
||||
window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}'
|
||||
window.requirejs = {
|
||||
"paths" : {
|
||||
"moment": "libs/#{lib('moment')}",
|
||||
|
|
|
@ -167,6 +167,8 @@ module.exports = settings =
|
|||
url: v1Api.url
|
||||
user: v1Api.user
|
||||
pass: v1Api.pass
|
||||
v1_history:
|
||||
url: "http://#{process.env['V1_HISTORY_HOST'] or "localhost"}:3100/api"
|
||||
|
||||
templates:
|
||||
user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2"
|
||||
|
@ -213,6 +215,8 @@ module.exports = settings =
|
|||
defaultFeatures: defaultFeatures =
|
||||
collaborators: -1
|
||||
dropbox: true
|
||||
github: true
|
||||
gitBridge: true
|
||||
versioning: true
|
||||
compileTimeout: 180
|
||||
compileGroup: "standard"
|
||||
|
@ -509,4 +513,4 @@ module.exports = settings =
|
|||
'iframe': [ 'allowfullscreen', 'frameborder', 'height', 'src', 'width' ]
|
||||
'img': [ 'alt', 'class', 'src', 'style' ]
|
||||
'source': [ 'src', 'type' ]
|
||||
'video': [ 'alt', 'class', 'controls', 'height', 'width' ]
|
||||
'video': [ 'alt', 'class', 'controls', 'height', 'width' ]
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
"nodemailer-ses-transport": "^1.3.0",
|
||||
"nvd3": "^1.8.6",
|
||||
"optimist": "0.6.1",
|
||||
"overleaf-error-type": "git+https://github.com/overleaf/overleaf-error-type.git",
|
||||
"passport": "^0.3.2",
|
||||
"passport-google-oauth20": "^1.0.0",
|
||||
"passport-ldapauth": "^0.6.0",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
25
services/web/scripts/add_git_bridge_feature.js
Normal file
25
services/web/scripts/add_git_bridge_feature.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const { db } = require('../app/js/infrastructure/mongojs')
|
||||
const logger = require('logger-sharelatex')
|
||||
logger.logger.level('error')
|
||||
|
||||
logger.log({}, 'Updating users in mongo')
|
||||
|
||||
db.users.update(
|
||||
{
|
||||
'features.github': true
|
||||
},
|
||||
{
|
||||
$set: { 'features.gitBridge': true }
|
||||
},
|
||||
function(err, result) {
|
||||
if (err) {
|
||||
logger.err({ err: err, result: result }, 'Error updating users in mongo')
|
||||
return
|
||||
}
|
||||
logger.log(
|
||||
{ result: result },
|
||||
'Updated users who have github to have gitBridge too'
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
)
|
|
@ -16,6 +16,7 @@ module.exports =
|
|||
dropbox: false
|
||||
versioning: false
|
||||
github: true
|
||||
gitBridge: true
|
||||
templates: false
|
||||
references: false
|
||||
referencesSearch: false
|
||||
|
@ -28,6 +29,7 @@ module.exports =
|
|||
dropbox: false
|
||||
versioning: false
|
||||
github: false
|
||||
gitBridge: false
|
||||
templates: false
|
||||
references: false
|
||||
referencesSearch: false
|
||||
|
@ -40,6 +42,7 @@ module.exports =
|
|||
dropbox: true
|
||||
versioning: true
|
||||
github: true
|
||||
gitBridge: true
|
||||
templates: true
|
||||
references: true
|
||||
referencesSearch: true
|
||||
|
@ -52,6 +55,7 @@ module.exports =
|
|||
dropbox: true
|
||||
versioning: true
|
||||
github: true
|
||||
gitBridge: true
|
||||
templates: true
|
||||
references: true
|
||||
referencesSearch: true
|
||||
|
|
|
@ -28,6 +28,33 @@ describe "AuthorizationMiddlewear", ->
|
|||
@ObjectId.isValid.withArgs(@project_id).returns true
|
||||
@next = sinon.stub()
|
||||
|
||||
describe "_getUserId", ->
|
||||
beforeEach ->
|
||||
@req = {}
|
||||
|
||||
it "should get the user from session", (done) ->
|
||||
@AuthenticationController.getLoggedInUserId = sinon.stub().returns("1234")
|
||||
@AuthorizationMiddlewear._getUserId @req, (err, user_id) =>
|
||||
expect(err).to.not.exist
|
||||
expect(user_id).to.equal "1234"
|
||||
done()
|
||||
|
||||
it "should get oauth_user from request", (done) ->
|
||||
@AuthenticationController.getLoggedInUserId = sinon.stub().returns(null)
|
||||
@req.oauth_user = {_id: "5678"}
|
||||
@AuthorizationMiddlewear._getUserId @req, (err, user_id) =>
|
||||
expect(err).to.not.exist
|
||||
expect(user_id).to.equal "5678"
|
||||
done()
|
||||
|
||||
it "should fall back to null", (done) ->
|
||||
@AuthenticationController.getLoggedInUserId = sinon.stub().returns(null)
|
||||
@req.oauth_user = undefined
|
||||
@AuthorizationMiddlewear._getUserId @req, (err, user_id) =>
|
||||
expect(err).to.not.exist
|
||||
expect(user_id).to.equal null
|
||||
done()
|
||||
|
||||
METHODS_TO_TEST = {
|
||||
"ensureUserCanReadProject": "canUserReadProject"
|
||||
"ensureUserCanWriteProjectSettings": "canUserWriteProjectSettings"
|
||||
|
|
Loading…
Reference in a new issue