|
1 | 1 | /*
|
2 |
| - * Copyright 2014-2015 MarkLogic Corporation |
| 2 | + * Copyright 2014-2016 MarkLogic Corporation |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -75,6 +75,33 @@ function setupUsers(manager, done) {
|
75 | 75 | }
|
76 | 76 | }).result();
|
77 | 77 | }).
|
| 78 | + then(function(response) { |
| 79 | + return manager.get({ |
| 80 | + endpoint: '/manage/v2/roles/'+encodeURIComponent('rest-temporal-writer') |
| 81 | + }).result(); |
| 82 | + }). |
| 83 | + then(function(response) { |
| 84 | + if (response.statusCode < 400) { |
| 85 | + return this; |
| 86 | + } |
| 87 | + return manager.post({ |
| 88 | + endpoint: '/manage/v2/roles', |
| 89 | + body: { |
| 90 | + 'role-name': 'rest-temporal-writer', |
| 91 | + description: 'REST writer with temporal privileges', |
| 92 | + role: [ |
| 93 | + 'rest-writer' |
| 94 | + ], |
| 95 | + privilege: [ |
| 96 | + { |
| 97 | + 'privilege-name': 'temporal-statement-set-system-time', |
| 98 | + action: 'http://marklogic.com/xdmp/privileges/temporal-statement-set-system-time', |
| 99 | + kind: 'execute' |
| 100 | + } |
| 101 | + ] |
| 102 | + } |
| 103 | + }).result(); |
| 104 | + }). |
78 | 105 | then(function(response) {
|
79 | 106 | return manager.get({
|
80 | 107 | endpoint: '/manage/v2/users'
|
@@ -112,6 +139,13 @@ function setupUsers(manager, done) {
|
112 | 139 | description: 'rest-writer user with evaluate privileges',
|
113 | 140 | password: testconfig.restEvaluatorConnection.password
|
114 | 141 | };
|
| 142 | + userName = testconfig.restTemporalConnection.user; |
| 143 | + requiredUsers[userName] = { |
| 144 | + role: 'rest-temporal-writer', |
| 145 | + 'user-name': userName, |
| 146 | + description: 'rest-writer user with temporal privileges', |
| 147 | + password: testconfig.restTemporalConnection.password |
| 148 | + }; |
115 | 149 |
|
116 | 150 | response.data['user-default-list']['list-items']['list-item'].
|
117 | 151 | forEach(function(user) {
|
|
0 commit comments