mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-05 20:54:27 +08:00
fix naming things
This commit is contained in:
parent
70ae14a9b8
commit
99185871c4
16 changed files with 35 additions and 35 deletions
|
@ -33,7 +33,7 @@ module ClientApi
|
|||
|
||||
def check_invite_users_permission
|
||||
@team = Team.find_by_id(params[:team_id])
|
||||
if @team && !can_manage_user_team?(@team)
|
||||
if @team && !can_manage_team_users?(@team)
|
||||
respond_422(t('client_api.invite_users.permission_error'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,7 +58,7 @@ module ClientApi
|
|||
|
||||
def check_manage_user_team_permission
|
||||
user_team = UserTeam.find_by_id(params[:user_team])
|
||||
unless can_manage_user_team?(user_team.team)
|
||||
unless can_manage_team_users?(user_team.team)
|
||||
respond_422(t('client_api.user_teams.permission_error'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -105,7 +105,7 @@ class CustomFieldsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_create_permissions
|
||||
render_403 unless can_manage_sample_elements?(@team)
|
||||
render_403 unless can_manage_sample_columns?(@team)
|
||||
end
|
||||
|
||||
def check_update_and_delete_permissions
|
||||
|
|
|
@ -324,7 +324,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_create_permissions
|
||||
render_403 unless can_create_project?(current_team)
|
||||
render_403 unless can_create_projects?(current_team)
|
||||
end
|
||||
|
||||
def check_view_notifications_permissions
|
||||
|
|
|
@ -916,7 +916,7 @@ class ProtocolsController < ApplicationController
|
|||
def check_create_permissions
|
||||
load_team_and_type
|
||||
|
||||
if !can_create_protocol?(@current_team) || @type == :archive
|
||||
if !can_create_protocols_in_repository?(@current_team) || @type == :archive
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
@ -926,7 +926,7 @@ class ProtocolsController < ApplicationController
|
|||
@original = Protocol.find_by_id(params[:id])
|
||||
|
||||
if @original.blank? ||
|
||||
!can_clone_protocol?(@original) || @type == :archive
|
||||
!can_clone_protocol_in_repository?(@original) || @type == :archive
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
@ -1063,7 +1063,7 @@ class ProtocolsController < ApplicationController
|
|||
@protocol_json.present? &&
|
||||
@team.present? &&
|
||||
(@type == :public || @type == :private) &&
|
||||
can_create_protocol?(@team)
|
||||
can_create_protocols_in_repository?(@team)
|
||||
)
|
||||
render_403
|
||||
end
|
||||
|
|
|
@ -305,7 +305,7 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def check_create_permissions
|
||||
render_403 unless can_manage_repository?(@team) ||
|
||||
render_403 unless can_create_repositories?(@team) ||
|
||||
@team.repositories.count < Constants::REPOSITORIES_LIMIT
|
||||
end
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class RepositoryColumnsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_create_permissions
|
||||
render_403 unless can_manage_repository_column?(@repository.team)
|
||||
render_403 unless can_create_repository_columns?(@repository.team)
|
||||
end
|
||||
|
||||
def check_update_and_delete_permissions
|
||||
|
|
|
@ -134,7 +134,7 @@ class SampleGroupsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_permissions
|
||||
render_403 unless can_manage_sample_elements?(@team)
|
||||
render_403 unless can_manage_sample_columns?(@team)
|
||||
end
|
||||
|
||||
def sample_group_params
|
||||
|
|
|
@ -130,7 +130,7 @@ class SampleTypesController < ApplicationController
|
|||
end
|
||||
|
||||
def check_permissions
|
||||
render_403 unless can_manage_sample_elements?(@team)
|
||||
render_403 unless can_manage_sample_columns?(@team)
|
||||
end
|
||||
|
||||
def set_sample_type
|
||||
|
|
|
@ -5,7 +5,7 @@ class ProtocolsDatatable < CustomDatatable
|
|||
|
||||
def_delegator :@view, :can_update_protocol_in_repository?
|
||||
def_delegator :@view, :edit_protocol_path
|
||||
def_delegator :@view, :can_clone_protocol?
|
||||
def_delegator :@view, :can_clone_protocol_in_repository?
|
||||
def_delegator :@view, :clone_protocol_path
|
||||
def_delegator :@view, :can_update_protocol_type_in_repository?
|
||||
def_delegator :@view, :can_read_protocol_in_repository?
|
||||
|
@ -88,8 +88,8 @@ class ProtocolsDatatable < CustomDatatable
|
|||
team: @team,
|
||||
type: @type)
|
||||
end,
|
||||
'DT_CanClone': can_clone_protocol?(protocol),
|
||||
'DT_CloneUrl': if can_clone_protocol?(protocol)
|
||||
'DT_CanClone': can_clone_protocol_in_repository?(protocol),
|
||||
'DT_CloneUrl': if can_clone_protocol_in_repository?(protocol)
|
||||
clone_protocol_path(protocol,
|
||||
team: @team,
|
||||
type: @type)
|
||||
|
|
|
@ -8,7 +8,7 @@ module SamplesHelper
|
|||
end
|
||||
|
||||
def can_add_sample_related_things_to_team
|
||||
can_manage_sample_elements?(@team)
|
||||
can_manage_sample_columns?(@team)
|
||||
end
|
||||
|
||||
def all_custom_fields
|
||||
|
|
|
@ -13,17 +13,17 @@ Canaid::Permissions.register_for(Team) do
|
|||
end
|
||||
|
||||
# invite user to team, change user's role, remove user from team
|
||||
can :manage_user_team do |user, team|
|
||||
can :manage_team_users do |user, team|
|
||||
user.is_admin_of_team?(team)
|
||||
end
|
||||
|
||||
# create project
|
||||
can :create_project do |user, team|
|
||||
can :create_projects do |user, team|
|
||||
user.is_normal_user_or_admin_of_team?(team)
|
||||
end
|
||||
|
||||
# create protocol in repository, import protocol to repository
|
||||
can :create_protocol do |user, team|
|
||||
can :create_protocols_in_repository do |user, team|
|
||||
user.is_normal_user_or_admin_of_team?(team)
|
||||
end
|
||||
|
||||
|
@ -34,12 +34,12 @@ Canaid::Permissions.register_for(Team) do
|
|||
|
||||
# create custom field
|
||||
# create, update, delete sample type or sample group
|
||||
can :manage_sample_elements do |user, team|
|
||||
can :manage_sample_columns do |user, team|
|
||||
user.is_normal_user_or_admin_of_team?(team)
|
||||
end
|
||||
|
||||
# create, copy repository
|
||||
can :manage_repository do |user, team|
|
||||
can :create_repositories do |user, team|
|
||||
user.is_admin_of_team?(team)
|
||||
end
|
||||
|
||||
|
@ -49,7 +49,7 @@ Canaid::Permissions.register_for(Team) do
|
|||
end
|
||||
|
||||
# create repository column
|
||||
can :manage_repository_column do |user, team|
|
||||
can :create_repository_columns do |user, team|
|
||||
user.is_normal_user_or_admin_of_team?(team)
|
||||
end
|
||||
end
|
||||
|
@ -77,8 +77,8 @@ Canaid::Permissions.register_for(Protocol) do
|
|||
end
|
||||
|
||||
# clone protocol in repository
|
||||
can :clone_protocol do |user, protocol|
|
||||
can_create_protocol?(user, protocol.team) &&
|
||||
can :clone_protocol_in_repository do |user, protocol|
|
||||
can_create_protocols_in_repository?(user, protocol.team) &&
|
||||
can_read_protocol_in_repository?(user, protocol)
|
||||
end
|
||||
end
|
||||
|
@ -93,14 +93,14 @@ end
|
|||
Canaid::Permissions.register_for(CustomField) do
|
||||
# update, delete custom field
|
||||
can :update_or_delete_custom_field do |user, custom_field|
|
||||
can_manage_sample_elements?(user, custom_field.team)
|
||||
can_manage_sample_columns?(user, custom_field.team)
|
||||
end
|
||||
end
|
||||
|
||||
Canaid::Permissions.register_for(Repository) do
|
||||
# edit, destroy repository
|
||||
can :update_or_delete_repository do |user, repository|
|
||||
can_manage_repository?(user, repository.team)
|
||||
can_create_repositories?(user, repository.team)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -114,6 +114,6 @@ end
|
|||
Canaid::Permissions.register_for(RepositoryColumn) do
|
||||
# update, delete repository column
|
||||
can :update_or_delete_repository_column do |user, repository_column|
|
||||
can_manage_repository_column?(user, repository_column.repository.team)
|
||||
can_create_repository_columns?(user, repository_column.repository.team)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<%= t(@type == :public ? "protocols.index.public_description" : "protocols.index.private_description") %>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-default" <%= can_create_protocol?(@current_team) ? "data-action=create-new" : "disabled=disabled" %> data-url="<%= create_new_modal_protocols_path(team: @current_team, type: @type) %>">
|
||||
<a class="btn btn-default" <%= can_create_protocols_in_repository?(@current_team) ? "data-action=create-new" : "disabled=disabled" %> data-url="<%= create_new_modal_protocols_path(team: @current_team, type: @type) %>">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
<span class="hidden-xs"> <%= t("protocols.index.create_new") %></span>
|
||||
</a>
|
||||
|
@ -50,13 +50,13 @@
|
|||
</div>
|
||||
|
||||
<div id="import-export-protocols" class="btn-group" role="group">
|
||||
<a class="btn btn-default btn-open-file" <%= can_create_protocol?(@current_team) ? 'data-action="import"' : 'disabled="disabled"' %>>
|
||||
<a class="btn btn-default btn-open-file" <%= can_create_protocols_in_repository?(@current_team) ? 'data-action="import"' : 'disabled="disabled"' %>>
|
||||
<span class="glyphicon glyphicon-import"></span>
|
||||
<span class="hidden-xs"> <%= t("protocols.index.import") %></span>
|
||||
<input type="file" value="" accept=".eln" data-role="import-file-input"
|
||||
data-team-id="<%= @current_team.id %>"
|
||||
data-type="<%= @type %>" data-import-url="<%= import_protocols_path %>"
|
||||
<%= 'disabled="disabled"' unless can_create_protocol?(@current_team) %>>
|
||||
<%= 'disabled="disabled"' unless can_create_protocols_in_repository?(@current_team) %>>
|
||||
</a>
|
||||
<a class="btn btn-default" data-action="export" data-export-url="<%= export_protocols_path() %>">
|
||||
<span class="glyphicon glyphicon-export"></span>
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
data-toggle="dropdown"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="true"
|
||||
<%= "disabled='disabled'" unless can_manage_repository?(repository.team) %>>
|
||||
<%= "disabled='disabled'" if !can_update_or_delete_repository?(repository) and !can_create_repositories?(repository.team) %>>
|
||||
<span class="glyphicon glyphicon-cog"></span>
|
||||
<span class="caret"></span>
|
||||
</div>
|
||||
<% if can_manage_repository?(repository.team) %>
|
||||
<% if can_update_or_delete_repository?(repository) or can_create_repositories?(repository.team) %>
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li class="dropdown-header">
|
||||
<%= t("repositories.index.options_dropdown.header") %>
|
||||
|
@ -80,7 +80,7 @@
|
|||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right smart-dropdown" id="repository-columns-list">
|
||||
<% if can_manage_repository_column?(repository.team) %>
|
||||
<% if can_create_repository_columns?(repository.team) %>
|
||||
<li class="add-new-column-form">
|
||||
<div id="new-column-form" class="form-group" data-action="<%= repository_repository_columns_path(repository) %>">
|
||||
<div class="input-group">
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
<!-- Add new repository tab -->
|
||||
<li role="presentation"
|
||||
<% unless can_manage_repository?(current_team) || current_team.repositories.count < Constants::REPOSITORIES_LIMIT %>
|
||||
<% unless can_create_repositories?(current_team) || current_team.repositories.count < Constants::REPOSITORIES_LIMIT %>
|
||||
class="disabled"
|
||||
<% end %>>
|
||||
<a
|
||||
<% if can_manage_repository?(current_team) && current_team.repositories.count < Constants::REPOSITORIES_LIMIT %>
|
||||
<% if can_create_repositories?(current_team) && current_team.repositories.count < Constants::REPOSITORIES_LIMIT %>
|
||||
href="<%= create_modal_team_repositories_path %>"
|
||||
class='create-repository'
|
||||
data-remote='true'
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right smart-dropdown" id="samples-columns-list">
|
||||
<% if can_manage_sample_elements?(@team) %>
|
||||
<% if can_manage_sample_columns?(@team) %>
|
||||
<li class="add-new-column-form">
|
||||
<div id="new-column-form" class="form-group" data-action="<%= team_custom_fields_path(@team) %>">
|
||||
<div class="input-group">
|
||||
|
|
Loading…
Add table
Reference in a new issue