Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
e6263b8b
Commit
e6263b8b
authored
8 years ago
by
Giovanne Marcelo
Browse files
Options
Downloads
Patches
Plain Diff
Small fix
parent
e8adb200
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/collection.rb
+2
-2
2 additions, 2 deletions
app/models/collection.rb
app/policies/collection_policy.rb
+2
-3
2 additions, 3 deletions
app/policies/collection_policy.rb
with
4 additions
and
5 deletions
app/models/collection.rb
+
2
−
2
View file @
e6263b8b
...
...
@@ -59,9 +59,9 @@ class Collection < ActiveRecord::Base
end
def
user_own?
(
user
)
return
false
unless
user
.
is_a?
User
return
user
.
is_admin?
||
owner?
(
user
)
return
true
if
user
.
is_a?
Institution
and
owner
.
users
.
include?
(
user
)
return
false
unless
user
.
is_a?
User
user
.
is_admin?
||
owner?
(
user
)
end
def
private?
...
...
This diff is collapsed.
Click to expand it.
app/policies/collection_policy.rb
+
2
−
3
View file @
e6263b8b
...
...
@@ -12,9 +12,8 @@ class CollectionPolicy < ApplicationPolicy
end
def
resolve
if
@user
.
nil?
scope
.
where
(
privacy:
'public'
)
elsif
@user
.
id
==
@user_id
||
@user
.
is_admin?
if
@user
.
try
(
:id
)
==
@user_id
||
@user
.
try
(
:is_admin?
)
scope
.
all
else
scope
.
where
(
privacy:
'public'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment