Make adding new objects check can_edit first in ajax.
Fix code error in Device can_view.