user permission Typo3 : disable the creation of new objects in my extension by some BE groups, leaving only the possibility to modify - typo3

I wrote my Typo3 Extension,
I created a BE group that has permissions on my extension
I would like to know how to "remove" the possibility of adding new records (model objects) to my extension (NEW function, in list mode in my sys_folder containing the list of model object of my extension), leaving the possibility of modifying existing objects unchanged.
Thank you in advance for any solution.

It's impossible - because there are logical reasons against it.
If an editor is allowed to fully modify a "product XY", he is also allowed (and it is possible for him) to modify all properties so "product XY" is getting a "product A". Modifying a record allows you to build a totally other record on the origin base. The only leaving property would be the UID of the record.

Solution (add in Page TSConfig) :
mod.web_list {
deniedNewTables = "My Extension Table"
}

Related

How to dynamically change dialog with select field

I'm new to Magnolia, and I'm making my own module.
I have a dialog box when adding a component and I want to change next fields below dynamically using a select field.
Example:
Select field with {"type 1", "type 2", ...}
IF "type 1" is selected
->show a text field below
ELSE
->show a basicUpload field below
Thanks in advance.
I believe same was already discussed here and few other places if you look over questions tagged "magnolia".
Long story short, fields are atomic, independent entities. They do not know about each other. So the only way to create such dynamic connection is over "parent" form. You need to extend form presenter and field factory (if you want select that would be SelectFieldFactory) and in there, when field is created, attach value changed or similar listener to it so when value is changed in the field, you can inform presenter to make some other field visible or hide it.
IIRC you can see example of that done in External Forms module (if you have access to enterprise code). Not sure if any of the community modules show the same.

Attempt to insert record on page ... where this table, fe_users/fe_groups, is not allowed

I looked at this Similar Question on here but I didn't understand half of what everyone is saying there as I'm not very familiar with TypoScript...
Let me start from my point of view: I got a backend tree in TYPO3 6.2 that looks like this:
Data is of type "Folder" where I want to store my records.
Userroles, Admins and Lawyer are of Type "Standard" while the last two contain the Plugin "Website Users".
Now I want to add a new fe_usergroup to page Userroles:
I get following error:
It's the same when I try inserting a new fe_user in Admins:
So in the other answers from mentioned question they're talking about Page-TS-Config - I looked at my Userroles Page and saw this:
and I went to the Template Analyzer and searched for allowedNewTables and deniedNewTables but no results. And to the comment: section ctrl which value has rootLevel - but those TCAs are from Extbase right? So why would they be wrong...
I must have done something wrong but I have no idea what it could be.
It worked before I think...although I don't know about the usergroups, didn't try to add a new one recently.
I placed
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_myext_download');
into the ext_tables.php of myext to allow this kind of records.
Maybe that helps.
Add in Your ext_tables.php in Your Extension following code:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_your_extension_table_name');
In TYPO3, you have to define, which tables are allowed on standard pages. There is a method in the ExtensionManagementUtility, that does extacly that:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_yourtable');
If you have a look at the source, you'll see, that this method ist just one line of code that concatenates table names into the global configuration array, specifically at
$GLOBALS['PAGES_TYPES']['default']['allowedTables']
Its possible that something in your TYPO3 installation messes with this line.
Check the value of this configuration value in either the Install Tool or the Confuguration tab in the backend. If this line contains anything other than comma seperated table names, something is wrong. TYPO3 base table names like pages,tt_content,fe_users,fe_groups and so on should also be listed there by default.
Is the page that you are trying to add usergroups to of type "page" or "directory" (see "General"-tab). Probably it must be of kind "directory" or "folder"

Symfony2: Entity instantiation upon Form-Submit depending on user selection

I'm working with Symfony2 to set up a form, where a Shelf-Entity can be edited.
A shelf contains a collection of Readable-Entities (e.g. Book, Magazine, etc. - all inherit from Readable).
The user has the possibility to add more Readable-Entities (the form is extended via JavaScript) and from a dropdown he can select the type of Readable he wants to add. Depending on the selected dropdown-value, different form fields are rendered. So far so good.
Now, when the form is submitted to the server, depending on the Readable-Type the user selected in the form, a different entity-type should be instantiated.
If I don't do anything, Symfony just instantiates the base class Readable (and not Book, Magazine, etc.).
How can I tell Symfony to instantiate the correct type of Readable depending on the selected value from the dropdown?
I tried with FormEvent-Listeners, but:
in PRE_SUBMIT I only get an array containing the "raw" form data with $event->getData(), i.e. no entities have been instatiated so far. However, at this stage, I still have access to value of the dropdown.
in SUBMIT the form data was already assigned to the appropriate entities. Also the new Readable was already instatiated with the base Readable-Class. But now, I cannot access anymore the value from the dropdown.
What is the correct way to do this?
EDIT
Added a minimal Code-Example for the Shelf FormType:
https://gist.github.com/anonymous/401495b701982adafb96
Code for infinite_form_polycollection:
https://gist.github.com/anonymous/b5f0ed10ca9c52177f01
Have you tried looking at this part of the doc? As "embedding a form" seems to fit your needs.
It seems that there was something wrong with the PHP-Files of the PolyCollection in the vendor-directory, because after removing everything related to the Infinite Form Bundle from the vendor-dir and reinstalling it with composer, everything is working now. But thanks for your efforts YoannCh

enterprise architect api: Add element to a collection

I have few short questions regarding Enterprise architect.
My question is regarding the automation interface. When following the instructions provided on this page: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/colle... in order to add a new element to the collection ( and the .eap file) it does not add the element. I can get data from the elements, modify and even delete them, but adding a new element does not work?
Instructions provided:
Call AddNew to add a new item.
Modify the item as required.
Call Update on the item to save it to the database.
Call Refresh on the collection to include it in the current set.
my java example:
elements is a collection of all the elements in the model...
org.sparx.Element elementEa = elements.AddNew("Requirement", "non-functional");
elementEa.Update();
elements.Refresh();
With the api is it possible to change the id or guid of an element since there are no methods specified in org.sparx for that?
One last thing... Is it possible to create a custom element in EA, for example a requirement which will not have the standard properties like difficulty, priority etc.. , but will have others? (normal properties, not tagged values)
The arguments to AddNew() are Name and Type, so to create a Requirement element you should specify "SomeRequirementName" and "Requirement".
You can't change the ID or GUID through the API, and your models would crash and burn if you did (connectors would be left dangling, elements would vanish from diagrams, etc, etc).
With an MDG Technology you can create very detailed stereotyped elements if you like, with their own visual representations (shape scripts) etc, but if you're after creating an element type with its own properties dialog the answer is no; there is no hook for a custom dialog in the API.
Collection<Package> packageCollection = myPackage.GetPackages();
Package consolidatedCfsSpecPackage = packageCollection.AddNew("somePackageName", "");
if (!consolidatedCfsSpecPackage.Update()) {
System.err.println("Not Updated: somePackageName");
}
packageCollection.Refresh();
This works for me. I suggest you to check return value of elementEa.Update() method you called. If it returns false, you can get the reason by calling elementEa.GetLastError().

transfer netbeans made component to lwuit's "Resource Editor"

I tried to use "table" Component in a Form with "Resource Editor" in lwuit, but I could not add/edit the rows items. so I end up with this question:
Is it possible to create/edit the table component in the generated "StateMachine" class in Netbeans and see the result in "Resource Editor"?
And if it's not possible, how can I hack the .res file in order to make the "table" as it should be?
There is support for live embedding in the resource editor but its deprecated and obtuse.
I suggest you just add a label where you want the custom component to be, give it a unique name and override the method createComponentInstance which is invoked internally with the name of the label (name it something unique).
You can then just return the instance of your custom made component and it will appear where the label is in the GUI builder.