Skip to content

Commit 6752500

Browse files
committed
renamed kuzzleSecurity.js -> Security.js
1 parent abc6a2c commit 6752500

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

src/Kuzzle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var
22
uuid = require('uuid'),
33
Collection = require('./Collection.js'),
4-
Security = require('./security/kuzzleSecurity'),
4+
Security = require('./security/Security'),
55
MemoryStorage = require('./MemoryStorage'),
66
User = require('./security/kuzzleUser'),
77
networkWrapper = require('./networkWrapper');
File renamed without changes.

src/security/kuzzleProfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var
22
SecurityDocument = require('./kuzzleSecurityDocument');
33

4-
function Profile(kuzzleSecurity, id, content) {
4+
function Profile(Security, id, content) {
55

6-
SecurityDocument.call(this, kuzzleSecurity, id, content);
6+
SecurityDocument.call(this, Security, id, content);
77

88
// Define properties
99
Object.defineProperties(this, {
@@ -17,8 +17,8 @@ function Profile(kuzzleSecurity, id, content) {
1717
});
1818

1919
// promisifying
20-
if (kuzzleSecurity.kuzzle.bluebird) {
21-
return kuzzleSecurity.kuzzle.bluebird.promisifyAll(this, {
20+
if (Security.kuzzle.bluebird) {
21+
return Security.kuzzle.bluebird.promisifyAll(this, {
2222
suffix: 'Promise',
2323
filter: function (name, func, target, passes) {
2424
var whitelist = ['hydrate', 'save'];
@@ -59,7 +59,7 @@ Profile.prototype.save = function (options, cb) {
5959

6060
data = this.serialize();
6161

62-
self.kuzzle.query(self.kuzzleSecurity.buildQueryArgs('createOrReplaceProfile'), data, options, cb && function (error) {
62+
self.kuzzle.query(self.Security.buildQueryArgs('createOrReplaceProfile'), data, options, cb && function (error) {
6363
cb(error, error ? undefined : self);
6464
});
6565

src/security/kuzzleRole.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var KuzzleSecurityDocument = require('./kuzzleSecurityDocument');
22

3-
function Role(kuzzleSecurity, id, content) {
3+
function Role(Security, id, content) {
44

5-
KuzzleSecurityDocument.call(this, kuzzleSecurity, id, content);
5+
KuzzleSecurityDocument.call(this, Security, id, content);
66

77
// Define properties
88
Object.defineProperties(this, {
@@ -16,8 +16,8 @@ function Role(kuzzleSecurity, id, content) {
1616
});
1717

1818
// promisifying
19-
if (kuzzleSecurity.kuzzle.bluebird) {
20-
return kuzzleSecurity.kuzzle.bluebird.promisifyAll(this, {
19+
if (Security.kuzzle.bluebird) {
20+
return Security.kuzzle.bluebird.promisifyAll(this, {
2121
suffix: 'Promise',
2222
filter: function (name, func, target, passes) {
2323
var whitelist = ['save'];
@@ -56,7 +56,7 @@ Role.prototype.save = function (options, cb) {
5656
options = null;
5757
}
5858

59-
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs('createOrReplaceRole'), data, options, cb && function (error) {
59+
self.kuzzle.query(this.Security.buildQueryArgs('createOrReplaceRole'), data, options, cb && function (error) {
6060
cb(error, error ? undefined : self);
6161
});
6262

src/security/kuzzleSecurityDocument.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function KuzzleSecurityDocument(kuzzleSecurity, id, content) {
1+
function KuzzleSecurityDocument(Security, id, content) {
22

33
if (!id) {
44
throw new Error('A security document must have an id');
@@ -8,10 +8,10 @@ function KuzzleSecurityDocument(kuzzleSecurity, id, content) {
88
Object.defineProperties(this, {
99
// private properties
1010
kuzzle: {
11-
value: kuzzleSecurity.kuzzle
11+
value: Security.kuzzle
1212
},
13-
kuzzleSecurity: {
14-
value: kuzzleSecurity
13+
Security: {
14+
value: Security
1515
},
1616
// read-only properties
1717
// writable properties
@@ -31,8 +31,8 @@ function KuzzleSecurityDocument(kuzzleSecurity, id, content) {
3131
}
3232

3333
// promisifying
34-
if (kuzzleSecurity.kuzzle.bluebird) {
35-
return kuzzleSecurity.kuzzle.bluebird.promisifyAll(this, {
34+
if (Security.kuzzle.bluebird) {
35+
return Security.kuzzle.bluebird.promisifyAll(this, {
3636
suffix: 'Promise',
3737
filter: function (name, func, target, passes) {
3838
var whitelist = ['delete', 'update'];
@@ -88,7 +88,7 @@ KuzzleSecurityDocument.prototype.delete = function (options, cb) {
8888
options = null;
8989
}
9090

91-
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs(this.deleteActionName), {_id: this.id}, options, function (error, res) {
91+
self.kuzzle.query(this.Security.buildQueryArgs(this.deleteActionName), {_id: this.id}, options, function (error, res) {
9292
if (error) {
9393
return cb ? cb(error) : false;
9494
}
@@ -124,7 +124,7 @@ KuzzleSecurityDocument.prototype.update = function (content, options, cb) {
124124
data._id = self.id;
125125
data.body = content;
126126

127-
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs(this.updateActionName), data, options, function (error, response) {
127+
self.kuzzle.query(this.Security.buildQueryArgs(this.updateActionName), data, options, function (error, response) {
128128
if (error) {
129129
return cb ? cb(error) : false;
130130
}
@@ -139,4 +139,4 @@ KuzzleSecurityDocument.prototype.update = function (content, options, cb) {
139139
return this;
140140
};
141141

142-
module.exports = KuzzleSecurityDocument;
142+
module.exports = KuzzleSecurityDocument;

src/security/kuzzleUser.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ var
22
KuzzleSecurityDocument = require('./kuzzleSecurityDocument');
33

44
/**
5-
* @param {Security} kuzzleSecurity
5+
* @param {Security} Security
66
* @param {string} id
77
* @param {Object} content
88
* @constructor
99
*/
10-
function User(kuzzleSecurity, id, content) {
10+
function User(Security, id, content) {
1111

12-
KuzzleSecurityDocument.call(this, kuzzleSecurity, id, content);
12+
KuzzleSecurityDocument.call(this, Security, id, content);
1313

1414
// Define properties
1515
Object.defineProperties(this, {
@@ -23,8 +23,8 @@ function User(kuzzleSecurity, id, content) {
2323
});
2424

2525
// promisifying
26-
if (kuzzleSecurity.kuzzle.bluebird) {
27-
return kuzzleSecurity.kuzzle.bluebird.promisifyAll(this, {
26+
if (Security.kuzzle.bluebird) {
27+
return Security.kuzzle.bluebird.promisifyAll(this, {
2828
suffix: 'Promise',
2929
filter: function (name, func, target, passes) {
3030
var whitelist = ['save', 'saveRestricted'];
@@ -100,7 +100,7 @@ User.prototype.save = function (options, cb) {
100100
options = null;
101101
}
102102

103-
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs('createOrReplaceUser'), data, options, cb && function (error) {
103+
self.kuzzle.query(this.Security.buildQueryArgs('createOrReplaceUser'), data, options, cb && function (error) {
104104
cb(error, error ? undefined : self);
105105
});
106106

@@ -128,7 +128,7 @@ User.prototype.saveRestricted = function (options, cb) {
128128
options = null;
129129
}
130130

131-
self.kuzzle.query(this.kuzzleSecurity.buildQueryArgs('createRestrictedUser'), data, options, cb && function (error) {
131+
self.kuzzle.query(this.Security.buildQueryArgs('createRestrictedUser'), data, options, cb && function (error) {
132132
cb(error, error ? undefined : self);
133133
});
134134

test/kuzzle/methods.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var
55
sandbox = sinon.sandbox.create(),
66
Kuzzle = rewire('../../src/Kuzzle'),
77
Collection = require('../../src/Collection.js'),
8-
Security = require('../../src/security/kuzzleSecurity'),
8+
Security = require('../../src/security/Security'),
99
User = require('../../src/security/kuzzleUser');
1010

1111
describe('Kuzzle methods', function () {

test/security/kuzzleSecurity/constructor.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ var
33
bluebird = require('bluebird'),
44
rewire = require('rewire'),
55
Kuzzle = rewire('../../../src/Kuzzle'),
6-
Security = require('../../../src/security/kuzzleSecurity');
6+
Security = require('../../../src/security/Security');
77

8-
describe('kuzzleSecurity constructor', function () {
9-
it('should initialize properties and return a valid kuzzleSecurity object', function () {
8+
describe('Security constructor', function () {
9+
it('should initialize properties and return a valid Security object', function () {
1010
var
1111
kuzzle = new Kuzzle('foo');
1212

test/security/kuzzleSecurityDocument/constructor.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('KuzzleSecurityDocument constructor', function () {
3434
var securityDocument = new KuzzleSecurityDocument(kuzzle.security, 'test', {});
3535

3636
should(securityDocument).have.propertyWithDescriptor('kuzzle', { enumerable: false, writable: false, configurable: false });
37-
should(securityDocument).have.propertyWithDescriptor('kuzzleSecurity', { enumerable: false, writable: false, configurable: false });
37+
should(securityDocument).have.propertyWithDescriptor('Security', { enumerable: false, writable: false, configurable: false });
3838
should(securityDocument).have.propertyWithDescriptor('id', { enumerable: true, writable: false, configurable: false });
3939
should(securityDocument).have.propertyWithDescriptor('content', { enumerable: true, writable: true, configurable: false });
4040
});

0 commit comments

Comments
 (0)