Draft: Improve permission checks and logic
1 open thread
- Fix rolify with_role to be combineable into larger queries without using .ids
- Add option to define rolify relations easily as has_many relations on models.
- Update associatable with the increased flexibility to let ActiveRecord combine queries better.
- Make use of hashes rather than
.ids
in the ability to prevent queries on load and allow CanCanCan to do its job better - Add extension to CanCanCan to allow joining can definitions with scopes together
TODO:
-
Check whether using .select(:id)
in the ability makes better queries than the left-overid: ....ids
. -
Check performance of new roles queries (left outer join) and determine whether its better to use scopes. -
Convert more of the ability file to use scopes.
Relates to #81
Edited by Taico Aerts
Merge request reports
Activity
added 68 commits
-
43612259...b297fda1 - 65 commits from branch
development
- eabbc60f - Merge branch 'development' into optimizations
- 52d4d019 - Fix error
- 434ba9e0 - Use new roles form for admin_ability
Toggle commit list-
43612259...b297fda1 - 65 commits from branch
added 20 commits
-
ae3c831d...96c97058 - 19 commits from branch
development
- 97b63197 - Merge branch 'development' into 'optimizations'
-
ae3c831d...96c97058 - 19 commits from branch
added 120 commits
-
97b63197...0414dfa0 - 119 commits from branch
development
- 9898b106 - Merge branch 'development' into optimizations
-
97b63197...0414dfa0 - 119 commits from branch
25 # Creates a `has_many` relation with the given name which returns an ActiveRecord::Relation of User. 26 # Additionally, a `has_many` association_name_roles will be made which returns an ActiveRecord::Relation of UsersRole. 27 # 28 # @param association_name [Symbol] the name of the association to add 29 # @param name_or_code [String, Symbol, Array, Proc, Lambda, Nil] the name of the role to add or a lambda to pass to the association (Default: all) 30 def relate_users_role(association_name, name_or_code = nil) 31 if name_or_code.nil? 32 has_many association_name, 33 through: :roles, 34 class_name: User.model_name.name, 35 source: :users 36 has_many "#{association_name}_roles".to_sym, 37 through: :roles, 38 class_name: UsersRole.model_name.name, 39 source: :users_roles 40 elsif name_or_code.is_a?(String) || name_or_code.is_a?(Symbol) || name_or_code.is_a?(Array) requested review from @mmladenov
added 170 commits
-
9898b106...36c50f37 - 159 commits from branch
development
- e8e4aff4 - Merge branch 'development' into optimizations
- cf932dab - Remove unnecessary role authorization checks
- 2d2b0b30 - Fix leaving not possible even with 2 users in company
- b528db85 - Prevent possible future issues for role invitations on groups which are not CSRs
- 12b6005c - Use safe navigation to prevent 500 error for invalid request
- a69888b1 - Update message
- 6fbc8a36 - Relate research group roles
- 2fefd09d - Add not_inactive? scope for CE
- b3820f57 - Load invitations without id
- 2aea529d - Merge show and join for company allow to join
- 3eb0383f - Restructure ability
Toggle commit list-
9898b106...36c50f37 - 159 commits from branch
added 301 commits
-
31e14e09...97ab24c5 - 300 commits from branch
development
- 3fe137fb - Merge branch 'development' into optimizations
-
31e14e09...97ab24c5 - 300 commits from branch
added 21 commits
-
3fe137fb...7cb1910b - 8 commits from branch
development
- a03bfeac - Optimize associatable
- 6bd9edb8 - Remove unused methods
- 5afe7864 - Small improvement
- 90090e77 - Remove unnecessary method
- e0a9f6c9 - Simplify relation
- efe88e7c - Remove unused User.company_users
- 0a3c5471 - Refactor preferences controllers to be better
- adce85e1 - Cleanup User more
- 706f6baa - Remove now unused methods
- 2ce22276 - Fix rubocop
- ce4b5f7f - Remove unused methods from experiment_project
- d06d6366 - Merge branch 'development' into optimizations
- ab5cbaa0 - Merge branch 'improve-associatable' into optimizations
Toggle commit list-
3fe137fb...7cb1910b - 8 commits from branch
Please register or sign in to reply