8000 updated: example (100% works with 1.7.3) · JavaScriptExpert/examples@0d828ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d828ae

Browse files
committed
updated: example (100% works with 1.7.3)
1 parent e56650b commit 0d828ae

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

authorization-roles/controllers/default.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ exports.install = function() {
33

44
framework.route('/', view_administrator, ['authorize', '@administrator']);
55
framework.route('/', view_moderator, ['authorize', '@moderator']);
6+
framework.route('/both/', view_both, ['authorize', '@moderator', '@administrator']);
67

78
framework.route('/login/', redirect_login, ['unauthorize']);
89
framework.route('/logoff/', redirect_logoff);
910
};
1011

12+
function view_both() {
13+
var self = this;
14+
self.plain('For both (moderator and administrator), current: ' + self.user.name);
15+
}
16+
1117
function view_administrator() {
1218
var self = this;
1319
self.view('administrator');

authorization-roles/views/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<div><a href="/login/?user=administrator">Sign in as Administrator</a></div>
2-
<div><a href="/login/?user=moderator">Sign in as Moderator</a></div>
2+
<div><a href="/login/?user=moderator">Sign in as Moderator</a></div>
3+
<div><a href="/login/?user=guest">Sign in as Guest (shows: 401 because we don't have any route)</a></div>

0 commit comments

Comments
 (0)
0