Skip to content
This repository was archived by the owner on Oct 5, 2020. It is now read-only.

Conversation

@grtjn
Copy link
Contributor

@grtjn grtjn commented Jan 30, 2016

#288

Uncomment few lines in node-app.js, and you by-pass auth entirely. Streamlined default app-user stuff to make it work out of the box as Guest with rest-reader/writer privs..

@grtjn grtjn modified the milestone: 1.0.2 Jan 31, 2016
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be read from Roxy properties instead of concatenated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but sounds like a lot of complexity. And still not convinced Node should depend on Roxy configs. I'd prefer the other way round..

Keep in mind this piece of code is only executed at start of project, directly after executing Roxy new, so naming of default-user is reliable at that point. If you would want to make it fully dynamic, gulp serve and service scripts would have to read Roxy props too..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safe for slush generator, as the line is commented out in build.properties by default, but worth considering for the (new) gulp init-local/dev/prod..

Copy link
Contributor Author

@grtjn grtjn Jun 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leveraging the relatively new ml env info --format=json in gulpfile, but overkill for slushfile..

@grtjn
Copy link
Contributor Author

grtjn commented Feb 10, 2016

I ran an elaborate test myself, but could use a test run from someone else to confirm. Had to streamline quite a bit..

' <privilege-name>rest-writer</privilege-name>\n' +
' </privilege>\n' +
' </privileges>\n');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using rest-reader/writer privs also requires making sure REST extensions and such get app-role permissions, or otherwise calls those REST extensions will fail. This means patching app_specific with something like:

  alias_method :original_deploy_rest, :deploy_rest
  def deploy_rest
    original_deploy_rest

    r = execute_query(%Q{
        xquery version "1.0-ml";

        for $uri in cts:uris()
        return (
            $uri,
            xdmp:document-set-permissions($uri, (
                xdmp:permission("#{@properties["ml.app-name"]}-role", "read"),
                xdmp:permission("#{@properties["ml.app-name"]}-role", "execute")
            ))
       )
      },
      { :db_name => @properties["ml.modules-db"] }
    )
    r.body = parse_json r.body
    logger.debug r.body
  end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to include a pre-made app_specific.rb in templates to solve this. Showcases some other nice gimmicks as well..

@grtjn grtjn modified the milestones: 1.2.0, 1.0.3 Mar 8, 2016
@grtjn grtjn force-pushed the 288-default-user branch 3 times, most recently from 0cfa613 to f96730a Compare June 17, 2016 07:41
@grtjn grtjn force-pushed the 288-default-user branch from f96730a to 69e8b60 Compare June 17, 2016 16:01
@grtjn grtjn changed the title Fixed #288: by-pass auth entirely in node with few lines Fixed #288: allow guest-acces, disallow updates, require app users only Jun 23, 2016
@grtjn grtjn removed the help wanted label Jul 11, 2016
@grtjn
Copy link
Contributor Author

grtjn commented Jul 11, 2016

Ran elaborate tests with this, merging now..

@grtjn grtjn merged commit e019112 into marklogic-community:master Jul 11, 2016
@grtjn
Copy link
Contributor Author

grtjn commented Nov 22, 2016

This also fixed #415..

@grtjn
Copy link
Contributor Author

grtjn commented Nov 23, 2016

This also fixes #246..

@grtjn
Copy link
Contributor Author

grtjn commented Nov 23, 2016

This also fixes #240..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants