-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #828 from gravitational/alexey/adding-acl
Alexey/adding acl
- Loading branch information
Showing
15 changed files
with
1,081 additions
and
502 deletions.
There are no files selected for viewing
1,383 changes: 933 additions & 450 deletions
1,383
web/dist/app/app.be4d2d2826e88fc673d3.js → web/dist/app/app.6a500c88f00b0a11eb77.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 18 additions & 18 deletions
36
web/dist/app/vendor.be4d2d2826e88fc673d3.js → web/dist/app/vendor.6a500c88f00b0a11eb77.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import keyMirror from 'keymirror' | ||
|
||
export default keyMirror({ | ||
USERACL_RECEIVE: null | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import reactor from 'app/reactor'; | ||
import cfg from 'app/config'; | ||
import api from 'app/services/api'; | ||
import { USERACL_RECEIVE } from './actionTypes'; | ||
|
||
export default { | ||
fetchAcl(){ | ||
return api.get(cfg.api.userAclPath) | ||
.then(json => { | ||
reactor.dispatch(USERACL_RECEIVE, json) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const userAcl = ['tlpt_user_acl']; | ||
|
||
export default { | ||
userAcl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Store, toImmutable } from 'nuclear-js'; | ||
import { Record, Map, List } from 'immutable'; | ||
import { USERACL_RECEIVE } from './actionTypes'; | ||
|
||
class AccessRec extends Record({ | ||
admin: Map({ | ||
enabled: false | ||
}), | ||
ssh: Map({ | ||
enabled: false, | ||
logins: List() | ||
}) | ||
}){ | ||
constructor(params){ | ||
super(params); | ||
} | ||
|
||
isAdminEnabled() { | ||
return this.getIn(['admin', 'enabled']); | ||
} | ||
|
||
isSshEnabled() { | ||
let logins = this.getIn(['ssh', 'logins']); | ||
return logins ? logins.size > 0 : false; | ||
} | ||
|
||
getSshLogins() { | ||
let logins = this.getIn(['ssh', 'logins']); | ||
if (!logins) { | ||
return [] | ||
} | ||
|
||
return logins.toJS(); | ||
} | ||
} | ||
|
||
export default Store({ | ||
getInitialState() { | ||
return new AccessRec(); | ||
}, | ||
|
||
initialize() { | ||
this.on(USERACL_RECEIVE, receiveAcl); | ||
} | ||
}) | ||
|
||
function receiveAcl(state, json) { | ||
json = json || {}; | ||
return new AccessRec(toImmutable(json)); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters