How to restrict adding more members in the group using StreamChatSwiftUI - swiftui

i am using StreamChatSwiftUI builit in ChatChannelView for chat, i see there is an option to 'add members' in the group info.
1 - How can i disable or hide this option ?
2 - There is no remove member option, how can i show remove existing member?
i tried
.navigationDestination(isPresented: $vm.isChannelCreated) {
if let controller = vm.channelController{
ChatChannelView(
viewFactory: CustomUIFactory.shared,
channelController: controller
)
}
}

Related

Hide empty group in Ag-grid after row update

How to remove empty groups from ag-grid after updateRowData. In the plnkr example, I am modifying country value for the row, I expect group name to be changed but instead a new group is created.
Code for modifying country name:
let toBeUpdate = [];
this.gridApi.forEachNode((rowNode, index) => {
if(rowNode.data && rowNode.data.athlete == 'Sadiq Khoja'){
var data = rowNode.data;
data.country = 'AAA Unknown X';
toBeUpdate.push(data);
}
});
this.gridApi.updateRowData({update:toBeUpdate});
https://plnkr.co/edit/PTuwR5zejS2xiLIg
(Press 'Add' button to change the country name)
UpdateRowData works when there is no row group.
In this case, instead of using updateRowData try using setRowData -
this.gridApi.setRowData(toBeUpdate);
This will also refresh the grid to reflect the changes in the row.
For more information you can read here - https://www.ag-grid.com/documentation/javascript/data-update/
The correct way to update your data would be to use the setDataValue on rowNode (see here).
Once you update your data, you need to refresh your view for grouping via the api by calling refreshClientSideRowModel.
So your update funciton should be as follows:
this.gridApi.forEachNode((rowNode, index) => {
if(rowNode.data && rowNode.data.athlete == 'Sadiq Khoja'){
rowNode.setDataValue('country', 'AAA Unknown X');
}
});
this.gridApi.refreshClientSideRowModel('group');
Demo

Custom form field in views

I'm trying to create a custom field for a view in Drupal 8 which allows to perform an action without changing the page (link). I guess I have to create a form inside that custom field but I do not know how to achieve it.
Any idea on how to do it or other alternative without redirecting to a route?
The view will be a list of custom entities and I need a button for each of the lines.
Thanks in advance!
Finally I solved it by following this steps:
I created a view custom field (generate:plugin:views:field with
drupal console)
I created a form (generate:form)
Then, in the view custom field render function return the form:
$form = \Drupal::formBuilder()->getForm('Drupal\test_module\Form\TestForm', $values->_entity->ID());
return $form;
It's important to notice that an incremental (dynamic) formId is needed for things to work properly. I did that by creating a static variable and a __construct() method as follows:
protected static $instanceId;
public function getFormId() {
return 'my_form_id_' . self::$instanceId;
}
public function __construct(){
if (empty(self::$instanceId)) {
self::$instanceId = 1;
}
else {
self::$instanceId++;
}
}

Add CMS menu item with fields in Silverstripe 3.6

Still a newbie in Silverstripe. I am experimenting with the CMS and I would like to create a new CMS menu with text fields in it. I managed to add a CMS menu item with a gridfield in it to add data objects but what I require is to have text fields directly inside the CMS menu item without creating a Data Object (similar to the Settings menu as shown in the image below)
Can someone guide me in what I need to extend and how to set the thing up? Many thanks in advance.
You can extend the settings section. The following example adds a tab called Social Media under the settings section and 2 fields FacebookURL and TwitterURL. You can change this to any fields / tabs that you want.
**mysite/_config/extensions.yml
---
Name: mysiteextensions
After: 'framework/*','cms/*'
---
SiteConfig:
extensions:
- SiteConfigDecorator
mysite/code/extensions/SiteConfigDecorator
<?php
class SiteConfigDecorator extends DataExtension {
private static $db = array(
'FacebookURL' => 'Varchar(200)',
'TwitterURL' => 'Varchar(200)'
);
private static $has_one = array(
'FooterQuoteButtonPage' => 'SiteTree'
);
public function updateCMSFields(FieldList $fields) {
$fields->addFieldToTab('Root.SocialMedia', TextField::create('FacebookURL', 'Facebook URL'));
$fields->addFieldToTab('Root.SocialMedia', TextField::create('TwitterURL', 'Twitter URL'));
}
function __construct() {
parent::__construct();
}
}
To access these fields in the templates, you use $SiteConfig.FIELDNAME. In this case it would be $SiteConfig.FacebookURL and $SiteConfig.TwitterURL

Is there any way to retrieve groups for member with option:directOnly=false using Admin SDK?

Provisioning API provided "directOnly" parameter to control range of groups when retrieving gropus that user belongs to. I supposed to migrate Admin SDK from Provisioning API, but I didn't find way to retrive groups for user with directOnly=false. How do I do it using Directory API?
I implemented following(pseudo language) because I couldn't find way to do.
But I think this is not efficient way.
I want to know is there any plan for "directOnly=false".
// 1. List all groups in domain
allGroupsInDomain = ... // "List all groups in domain"
// 2. List all members for each groups
allMembersForGroup = {}
for (group in allGroupsInDomain) {
allMembersForGroup[group] = ... // "List all members for group"
}
// 3. List all users in domain
allUsersInDomain = "List all users in domain"
// 4. List all groups for user(direct only)
allGroupsForUser = {} // I want to get this for all users
for (user in allUsersInDomain) {
directGroupsForUser = ... // "List all groups for user(direct only)"
for (group in directGroupsForUser) {
allGroupsForUser[user].add(group);
allGroupsForUser[user].add(searchAncestorsOf(group));
}
}
// 5. Calculate all groups for user contains not directly group using results of (1,2,3,4)
function searchAncestorsOf(group) {
ancestors = []
for (group_ in allGroupsInDomain) {
if (group_.hasMember(group)) {
ancestors.add(group_);
ancestors.add(searchAncestorsOf(group_));
}
}
return ancestors;
}
https://developers.google.com/google-apps/provisioning/#retrieving_all_groups_for_a_member
https://developers.google.com/admin-sdk/directory/v1/reference/groups/list
There is no single API call method to get a user's direct and indirect group memberships currently available with Admin SDK. The quickest method I can think of for a few users would be:
Get all direct membership groups for a user with members.list and the userKey parameter.
For each group the user is a direct member of, determine if that group is a member of other groups again by using members.list with the userKey being each group this time instead of the user. If the group is a member of another group, then the user would be an indirect member of the given group.

tt_address: add categorys of address to the template

Is it somehow possible to add the sub-group of a cetrain group the address is assigned to the html output?
In the template I have ###MAINGROUP### and ###GROUPLIST###. I can't use maingroup, cause it's not the case that the group I need is always the maingroup. And with the grouplist I can't say which group is the sub-group of the one group.
Anyone have an idea how I could do it?
And in addition to that I also need the value of a self created field in the tt_address table.
Edit:
I try it like #lorenz say. What I have so far:
ext_localconf.php:
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][]
='EXT:txnextaddresssort/class.tx_next_address_sort_addmarkers.php:tx_next_address_sort_addmarkers';
class.tx_next_address_sort_addmarkers.php:
<?php
class tx_next_address_sort_addmarkers {
function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf,
&$pObj) {
$lcObj = t3lib_div::makeInstance('tslib_cObj');
$lcObj->data = $address;
$markerArray['###SORTBEREICH###'] =
$lcObj->stdWrap($address['tx_nextaddresssort_sort_bereich'],
$lConf['tx_nextaddresssort_sort_bereich.']);
}
}
Extentionkey: next_address_sort
All I get is a blank screen, but no errors in apache log
No, there is no possibility to do that.
Yet you can write a custom extension that integrates the extraItemMarkerProcessorhook in tt_address. In ext_localconf.php, add:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][] ='EXT:myextension/class.tx_myextension_filename.php:tx_myextension_classname';
Then add a file class.tx_myextension_filename.php to your extension.:
class tx_myextension_classname {
public function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf, &$pObj) {
$lcObj = t3lib_div::makeInstance('tslib_cObj');
$lcObj->data = $address;
$markerArray['###MYFIELD###'] = $lcObj->stdWrap($address['myfieldlikeindatabase'], $lConf['myfieldlikeindatabase.']);
return $markerArray;
}
}
This would be an example for getting a field that is in the tt_address table and adding it to the markers so they can be used in a template. It is also stdWrap enabled.
Now, instead of getting a field, you should replace $address['myfieldlikeindatabase'] with a variable that contains the information you need. To receive the data, you can use the TYPO3 database API functions ($GLOBALS['TYPO3_DB']).