projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Admin/Nodes page
[arvados.git]
/
apps
/
workbench
/
app
/
models
/
arvados_base.rb
diff --git
a/apps/workbench/app/models/arvados_base.rb
b/apps/workbench/app/models/arvados_base.rb
index 267a4a9133ef1c9b5c05372488faa349d0ae332e..83588f0aa0152341267da8766db19c96c57a6a80 100644
(file)
--- a/
apps/workbench/app/models/arvados_base.rb
+++ b/
apps/workbench/app/models/arvados_base.rb
@@
-25,11
+25,11
@@
class ArvadosBase < ActiveRecord::Base
@attribute_sortkey ||= {
'id' => nil,
'uuid' => '000',
@attribute_sortkey ||= {
'id' => nil,
'uuid' => '000',
- 'owner' => '001',
+ 'owner
_uuid
' => '001',
'created_at' => '002',
'modified_at' => '003',
'created_at' => '002',
'modified_at' => '003',
- 'modified_by_user' => '004',
- 'modified_by_client' => '005',
+ 'modified_by_user
_uuid
' => '004',
+ 'modified_by_client
_uuid
' => '005',
'name' => '050',
'tail_kind' => '100',
'tail_uuid' => '100',
'name' => '050',
'tail_kind' => '100',
'tail_uuid' => '100',
@@
-73,6
+73,9
@@
class ArvadosBase < ActiveRecord::Base
end
new.private_reload(uuid)
end
end
new.private_reload(uuid)
end
+ def self.order(*args)
+ ArvadosResourceList.new(self).order(*args)
+ end
def self.where(*args)
ArvadosResourceList.new(self).where(*args)
end
def self.where(*args)
ArvadosResourceList.new(self).where(*args)
end
@@
-106,10
+109,12
@@
class ArvadosBase < ActiveRecord::Base
@kind = resp[:kind]
# these attrs can be modified by "save" -- we should update our copies
@kind = resp[:kind]
# these attrs can be modified by "save" -- we should update our copies
- %w(uuid owner created_at
- modified_at modified_by_user
modified_by_client
+ %w(uuid owner
_uuid
created_at
+ modified_at modified_by_user
_uuid modified_by_client_uuid
).each do |attr|
).each do |attr|
- self.send(attr + '=', resp[attr.to_sym])
+ if self.respond_to? "#{attr}=".to_sym
+ self.send(attr + '=', resp[attr.to_sym])
+ end
end
self
end
self
@@
-209,18
+214,20
@@
class ArvadosBase < ActiveRecord::Base
end
def editable?
end
def editable?
- (current_user and
+ (current_user and
current_user.is_active and
(current_user.is_admin or
(current_user.is_admin or
- current_user.uuid == self.owner))
+ current_user.uuid == self.owner
_uuid
))
end
def attribute_editable?(attr)
end
def attribute_editable?(attr)
- if "created_at modified_at modified_by_user modified_by_client updated_at".index(attr.to_s)
+ if "created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at".index(attr.to_s)
+ false
+ elsif not (current_user.andand.is_active)
false
false
- elsif "uuid owner
".index(attr.to_s)
- current_user
and current_user
.is_admin
+ elsif "uuid owner
_uuid".index(attr.to_s) or current_user.is_admin
+ current_user.is_admin
else
else
- current_user
and current_user.uuid == owner
+ current_user
.uuid == self.owner_uuid or current_user.uuid == self.uuid
end
end
end
end