mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Update permission markup
This commit is contained in:
parent
b0fe68553a
commit
f51416d83a
2 changed files with 13 additions and 13 deletions
|
@ -407,7 +407,7 @@ var ImageEditorModal = (function() {
|
|||
'mime-type': editButton.data('image-mime-type')
|
||||
};
|
||||
$('#filePreviewModal').modal('hide');
|
||||
$.post(editButton.data('start-edit-url'));
|
||||
$.post(editButton.data('image-start-edit-url'));
|
||||
initImageEditor(data, fileUrl);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
|
||||
Canaid::Permissions.register_for(Asset) do
|
||||
can :read_asset do |user, asset|
|
||||
object ||= asset.step
|
||||
object ||= asset.result
|
||||
object ||= asset.repository_cell
|
||||
object = asset.step || asset.result || asset.repository_cell
|
||||
|
||||
if object.class == Step
|
||||
case object
|
||||
when Step
|
||||
protocol = object.protocol
|
||||
can_read_protocol_in_module?(user, protocol) || can_read_protocol_in_repository?(user, protocol)
|
||||
elsif object.class == Result
|
||||
when Result
|
||||
can_read_experiment?(user, object.my_module.experiment)
|
||||
elsif object.class == RepositoryCell
|
||||
when RepositoryCell
|
||||
can_read_repository?(user, object.repository_column.repository)
|
||||
end
|
||||
end
|
||||
|
||||
can :manage_asset do |user, asset|
|
||||
object ||= asset.step
|
||||
object ||= asset.result
|
||||
object ||= asset.repository_cell
|
||||
object = asset.step || asset.result || asset.repository_cell
|
||||
|
||||
if object.class == Step
|
||||
case object
|
||||
when Step
|
||||
protocol = object.protocol
|
||||
can_manage_protocol_in_module?(user, protocol) || can_manage_protocol_in_repository?(user, protocol)
|
||||
elsif object.class == Result
|
||||
when Result
|
||||
can_manage_experiment?(user, object.my_module.experiment)
|
||||
elsif object.class == RepositoryCell && !object.repository_column.repository.is_a?(RepositorySnapshot)
|
||||
when RepositoryCell
|
||||
return false if object.repository_column.repository.is_a?(RepositorySnapshot)
|
||||
|
||||
can_manage_repository?(user, object.repository_column.repository)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue