├── .github ├── workflows │ └── matrix.yml └── CONTRIBUTORS.md ├── Rakefile ├── lib └── the_role.rb ├── Gemfile ├── .gitignore ├── the_role.gemspec └── README.md /.github/workflows/matrix.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /lib/the_role.rb: -------------------------------------------------------------------------------- 1 | require 'the_role_api' 2 | require 'the_role_management_panel' 3 | 4 | module TheRole; end 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | # Specify your gem's dependencies in the_role.gemspec 4 | gemspec 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | 4 | .bundle 5 | .config 6 | .yardoc 7 | 8 | .rvmrc 9 | .ruby-gemset 10 | .ruby-version 11 | 12 | _yardoc 13 | coverage 14 | Gemfile.lock 15 | InstalledFiles 16 | lib/bundler/man 17 | spec/dummy_app/public/assets 18 | 19 | tmp 20 | doc 21 | pkg 22 | rdoc 23 | 24 | test/tmp 25 | spec/reports 26 | test/version_tmp 27 | 28 | .DS_Store 29 | .LSOverride 30 | .AppleDouble -------------------------------------------------------------------------------- /.github/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # List of Contributors 2 | 3 | These people helped with development and testing of the project 4 | 5 | - [@o-200](https://github.com/o-200) 6 | - [@sk8higher](https://github.com/sk8higher) 7 | - [@Alex808r](https://github.com/Alex808r) 8 | - [@ekatebenkova](https://github.com/ekatebenkova) 9 | - @Pavelandr1207 10 | 11 | Also see other contributors: 12 | 13 | - https://github.com/the-teacher/the_role/graphs/contributors 14 | -------------------------------------------------------------------------------- /the_role.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | 4 | module TheRole 5 | VERSION = "3.9.0" 6 | end 7 | 8 | Gem::Specification.new do |s| 9 | s.name = "the_role" 10 | s.version = TheRole::VERSION 11 | s.authors = ["Ilya N. Zykin [the-teacher]"] 12 | s.email = ["zykin-ilya@ya.ru"] 13 | s.homepage = "https://github.com/the-teacher/the_role" 14 | s.summary = %q{Authorization for Rails} 15 | s.description = %q{Authorization gem for Ruby on Rails with Management Panel} 16 | 17 | s.files = `git ls-files`.split("\n").select{ |file_name| !(file_name =~ /^spec/) } 18 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 19 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 20 | s.require_paths = ["lib"] 21 | 22 | s.add_runtime_dependency 'the_role_api', '3.9.0' 23 | s.add_runtime_dependency 'the_role_management_panel', '3.8.3' 24 | end 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | TheRole 3.0 3 |

4 | 5 |

6 | Authorization gem for Ruby on Rails 7 | with Management Panel 8 |

9 | 10 |

11 | TheRole. Authorization gem for Ruby on Rails with Administrative interface 12 |

13 | 14 |

15 | Semantic. Flexible. Lightweight 16 |

17 | 18 |
19 | TheRole: Gem Version 20 | API: Gem Version 21 | GUI: Gem Version 22 | CI: Build Status 23 |  ruby-toolbox 24 |
25 | 26 |
27 |

28 | Strongly recommended to upgrade from TheRole2 to TheRole3. Please, do it ASAP. 29 |

30 |
31 | 32 | ### INTRO 33 | 34 | TheRole is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in with **2-level-hash**, and **stored in the database as a JSON string**. 35 | 36 |

37 | TheRole. Authorization gem for Ruby on Rails with Administrative interface 38 |

39 | 40 | Using hashes, makes role system extremely easy to configure and use 41 | 42 | * Any Role is a two-level hash, consisting of the sections and nested rules 43 | * A Section may be associated with a controller name 44 | * A Rule may be associated with an action name 45 | * A Section can have many rules 46 | * A Rule can be true or false 47 | * Sections and nested Rules provide an ACL (Access Control List) 48 | 49 | #### Management Panel 50 | 51 | 52 | 53 | 56 | 57 | 58 | 61 | 62 |
54 | http://localhost:3000/admin/roles 55 |
59 | TheRole GUI 60 |
63 | 64 | **Import/Export operations provided via TheRole Management Panel.** If you have 2 Rails apps, based on TheRole - you can move roles between them via export/import abilities of TheRole Management Panel. 65 | It can be usefull for Rails apps based on one engine. 66 | 67 |
68 | TheRole. Authorization gem for Ruby on Rails with Administrative interface 69 |
70 | 71 | #### Limitations by Design 72 | 73 | TheRole uses few conventions over configuration. 74 | It gives simplicity of code, but also some limitations. 75 | You have to know about them before using of TheRole: 76 | Limitations list 77 | 78 |
79 | 80 |
81 | 82 | TheRole. Installation 83 | 84 |
85 | 86 |
87 | 88 | TheRole API 89 | 90 |
91 | 92 |
93 | 94 | Integration with Rails controllers 95 | 96 |
97 | 98 |
99 | 100 | Integration with Rails views 101 | 102 |
103 | 104 |
105 | 106 | Using with Strong Parameters 107 | 108 |
109 | 110 |
111 | 112 | TheRole GUI. Installation 113 | 114 |
115 | 116 |
117 | 118 | ### FAQ 119 | 120 |
121 | 122 | 123 | 124 | 138 | 139 | 153 | 154 |
125 | 126 | 127 | 135 | 136 |
128 |

Why TheRole was created?

129 |

Who is Administrator?

130 |

Who is Moderator?

131 |

Who is Owner?

132 |

Few words about Ownership

133 |

Customization, Rake tasks, code generators

134 |
137 |
140 | 141 | 142 | 150 | 151 |
143 |

What does it mean semantic?

144 |

Virtual sections and rules

145 |

Limitations

146 |

Contributing

147 |

Migration form TheRole 2 to TheRole 3

148 |

PSQL: how to use native :json column?

149 |
152 |
155 | 156 |
157 | 158 |
159 | 160 | ### We need your feedback! 161 | 162 | If you have to say something about TheRole, or if you need help, there are few ways to contact us: 163 | 164 | 0. SKYPE: **ilya.killich** 165 | 0. Email: zykin-ilya@ya.ru 166 | 0. TWITTER: [@iam_teacher](https://twitter.com/iam_teacher) 167 | 0. Hash tag: [#the_role](https://twitter.com/hashtag/the_role) 168 | 0. Google group: [about the_role](https://groups.google.com/forum/#!forum/the_role) 169 | 170 |
171 | 172 | #### Test matrix 173 | 174 | * **RAILS:** 3.2.21, 4.0, 4.1, 4.2 175 | * **RUBY:** 1.9.3, 2.0, 2.1, 2.2 176 | * **DB**: sqlite, mysql, postgresql 177 | 178 | totally: 48 environments 179 | 180 |
181 | 182 | **Supported locales:** 183 | [the_role_api](https://github.com/TheRole/the_role_api/tree/master/config/locales) | 184 | [the_role_management_panel](https://github.com/TheRole/the_role_management_panel/tree/master/config/locales) 185 | (please, help us with them) 186 |
187 | 188 | ### MIT License 189 | 190 | [MIT License](https://github.com/TheRole/docs/blob/master/LICENSE.md) 191 | Copyright (c) 2012-2015 [Ilya N.Zykin](https://github.com/the-teacher) 192 | 193 | #### Maintainers 194 | 195 | [@the-teacher](https://github.com/the-teacher), 196 | [@sedx](https://github.com/sedx), 197 | [@seuros](https://github.com/seuros) 198 | 199 | #### Contributors 200 | 201 | [@igmarin](https://github.com/igmarin) 202 | [@doabit](https://github.com/doabit) 203 | [@linjunpop](https://github.com/linjunpop) 204 | [@egb3](https://github.com/egb3) 205 | [@klacointe](https://github.com/klacointe) 206 | [@niltonvasques](https://github.com/niltonvasques) 207 | 208 | [Thanks for contributors](https://github.com/the-teacher/the_role/graphs/contributors) 209 | --------------------------------------------------------------------------------