Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
RDMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
researchdata
RDMS
Merge requests
!358
Fixed FileSet accessibility
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fixed FileSet accessibility
bug_fix/467-filset-accessibility
into
develop
Overview
0
Commits
1
Pipelines
1
Changes
3
Merged
Gyan Gupta
requested to merge
bug_fix/467-filset-accessibility
into
develop
3 months ago
Overview
0
Commits
1
Pipelines
1
Changes
3
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
31ea17e3
1 commit,
3 months ago
3 files
+
64
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
hyrax/app/helpers/hyrax/workflows_helper.rb
0 → 100644
+
42
−
0
Options
# frozen_string_literal: true
module
Hyrax
module
WorkflowsHelper
# Does a workflow restriction exist for the given :object and
# given :ability?
#
# @note If the object responds to a :workflow_restriction?, we'll
# use that answer.
#
# This method doesn't answer what kind of restriction is in place
# (that requires a far more nuanced permissioning system than
# Hyrax presently has). Instead, it answers is there one in
# place. From that answer, you may opt out of rendering a region
# on a view (e.g. don't show links to the edit page).
#
# @param object [Object]
# @param ability [Ability]
#
# @return [false] when there are no applicable workflow restrictions
#
# @return [true] when there is an applicable workflow restriction,
# and you likely want to not render something.
#
# @note This is Jeremy, I encourage you to look at the views that
# call this method to understand the conceptual space this
# method covers.
#
# @todo As I noodle on this, I'm fairly certain we should be
# registering a CanCan ability check. I believe in
# promoting this to a helper method it will be easier to
# incorporate this into an ability.
#
# @see Hyrax::FileSetsController for non-view usage.
def
workflow_restriction?
(
object
,
ability:
current_ability
)
return
false
if
object
.
nil?
# Yup, we may get nil, and there's no restriction on nil
return
object
.
workflow_restriction?
if
object
.
respond_to?
(
:workflow_restriction?
)
return
false
if
ability
.
can?
(
:edit
,
object
)
||
ability
.
can?
(
:read
,
object
)
return
object
.
suppressed?
if
object
.
respond_to?
(
:suppressed?
)
false
end
end
end
\ No newline at end of file
Loading