I have dataobject in Documents.php:
class Documents extends DataObject {
private static $db = array(
'DocType' => 'Text',
'ApprovalDate' => 'Date',
'PublicationDate' => 'Date',
'DocNumber' => 'Text',
'DocTitle' => 'Text',
'KeyWords' => 'Text'
);
private static $has_one = array(
'Member' => 'Member')
...
static $api_access = true;
public function canEdit($member = null) {
return (Member::currentUserID() == $this->MemberID) || parent::canEdit($member);
}
public function canDelete($member = null) {
return (Member::currentUserID() == $this->MemberID) || parent::canDelete($member);
}
public function canView($member = null) {
return true;
}
public function canCreate($member = null) {
return true;
}
and MyAdmin.php:
class MyAdmin extends ModelAdmin {
private static $managed_models = array(
'Documents'
);
private static $url_segment = 'documents';
private static $menu_title = 'Документы';
I want all users could only view all documents and create new documents, and only owner (user with ID == MemberID) could edit and delete his documents.
It works OK when user tryes to edit or delete his documents. But when he tryes to create new document (push "create" button in CMS), a pop-up window "Forbidden" appeares : https://yadi.sk/i/bBbnYwa3qtxVy.
Please, give me any ideas.