Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 2030 Bytes
1 | module LoginSystem |
2 | |
3 | protected |
4 | |
5 | # overwrite this if you want to restrict access to only a few actions |
6 | # or if you want to check if the user has the correct rights |
7 | # example: |
8 | # |
9 | # # only allow nonbobs |
10 | # def authorize?(user) |
11 | # user.login != "bob" |
12 | # end |
13 | def authorize?(user) |
14 | true |
15 | end |
16 | |
17 | # overwrite this method if you only want to protect certain actions of the controller |
18 | # example: |
19 | # |
20 | # # don't protect the login and the about method |
21 | # def protect?(action) |
22 | # if ['action', 'about'].include?(action) |
23 | # return false |
24 | # else |
25 | # return true |
26 | # end |
27 | # end |
28 | def protect?(action) |
29 | true |
30 | end |
31 | |
32 | # login_required filter. add |
33 | # |
34 | # before_filter :login_required |
35 | # |
36 | # if the controller should be under any rights management. |
37 | # for finer access control you can overwrite |
38 | # |
39 | # def authorize?(user) |
40 | # |
41 | def login_required |
42 | |
43 | if not protect?(action_name) |
44 | return true |
45 | end |
46 | |
47 | if session[:user] and authorize?(session[:user]) |
48 | return true |
49 | end |
50 | |
51 | # store current location so that we can |
52 | # come back after the user logged in |
53 | store_location |
54 | |
55 | # call overwriteable reaction to unauthorized access |
56 | access_denied |
57 | return false |
58 | end |
59 | |
60 | # overwrite if you want to have special behavior in case the user is not authorized |
61 | # to access the current operation. |
62 | # the default action is to redirect to the login screen |
63 | # example use : |
64 | # a popup window might just close itself for instance |
65 | def access_denied |
66 | redirect_to :controller=>"/accounts", :action =>"login" |
67 | end |
68 | |
69 | # store current uri in the session. |
70 | # we can return to this location by calling return_location |
71 | def store_location |
72 | session[:return_to] = request.request_uri |
73 | end |
74 | |
75 | # move to the last store_location call or to the passed default one |
76 | def redirect_back_or_default(default) |
77 | if session[:return_to].nil? |
78 | redirect_to default |
79 | else |
80 | redirect_to_url session[:return_to] |
81 | session[:return_to] = nil |
82 | end |
83 | end |
84 | |
85 | end |