Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Only owner can edit and delete his objects

Go to End

2 Posts   1390 Views


Community Member, 19 Posts

1 April 2016 at 9:14pm

Edited: 08/04/2016 10:16pm

I'm new to Silverstripe and need help.
I have created simple dataobject:

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'

Give me please any idea how to customize my ModelAdmin so, that all users could only view all objects, and only owner (user with ID == MemberID) could edit and delete his objects?
As the result I want to see such picture: [img=" "]
I try to use such code:
if (!(Member::currentUserID() ==  $Value_of_MemberID_Field   )) {
		// add a view button
				->addComponent(new GridFieldViewButton());

How can I get $Value_of_MemberID_Field in the row of GridField?


Community Member, 19 Posts

15 April 2016 at 8:46pm