I need to send an email notification to all of the group members on a new task assignment. I have created a TaskListener in which I am trying to get all the users by group id. But every time it returns empty user list.
IdentityService is = Context.getProcessEngineConfiguration().getIdentityService();
List<User> users = is.createUserQuery().memberOfGroup("2007").list();
LOGGER.info("The users are: " +users); // Always prints []
Also, I have following dependencies in my pom.xml
<dependency>
<groupId>com.activiti</groupId>
<artifactId>activiti-app-logic</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.activiti</groupId>
<artifactId>activiti-app-data</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.activiti</groupId>
<artifactId>activiti-dmn-engine</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.activiti</groupId>
<artifactId>activiti-app-model</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.1</version>
</dependency>
should I have the org.activiti in my pom.xml instead of com.activiti?
Let me know if there is any other/better way to send notification to the group.
Thanks for your time
I use this way of getting list of users:
Set<String> users_list = authorityService.getContainedAuthorities(AuthorityType.USER, "yourGroupName", false);
Returns collection of all contained authorities - USERs in you group.
See method description: https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/security/AuthorityService.html#getContainedAuthorities-org.alfresco.service.cmr.security.AuthorityType-java.lang.String-boolean-
When you have such users list, you can get NodeRef of each user and get his e-mail address from NodeRef properties like this:
NodeRef user = personService.getPerson("userName");
String email = nodeService.getProperty(user, "email");
Hope it helps.
For custom event notification (i.e. task assignment) a task listener might help you.
PS: you cannot use com.activiti.classes unless you have bought a valid license.
Related
Hide MS Team
The MS teams has an options to Hide a team, but the graph api https://graph.microsoft.com/v1.0/me/joinedTeams doesn't return this field, is there any way we can retrive a list of teams that are hide by a current login user?
explored the graph api
As per the documentation in the resource Properties, there is no property mentioned as "hide": https://learn.microsoft.com/en-us/graph/api/resources/team?view=graph-rest-1.0#properties
You can raise a feature request for the same if you want this property:https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform
Hope this helps.
I am trying to create a table with map datatype in clickhouse but it is giving this error.
query: CREATE TABLE table_map (a Map(String, UInt64)) ENGINE=Memory;
Received exception from server (version 21.3.4):
Code: 44. DB::Exception: Received from localhost:9000. DB::Exception: Cannot create table with column 'a' which type is 'Map(String,UInt64)' because experimental Map type is not allowed. Set 'allow_experimental_map_type = 1' setting to enable.
How do I turn this feature on ? I am not able to figure it out.
you can enable it in default profile
cat /etc/clickhouse/users.d/allow_experimental_map_type.xml
<?xml version="1.0"?>
<yandex>
<profiles>
<default>
<allow_experimental_map_type>1</allow_experimental_map_type>
</default>
</profiles>
</yandex>
You can create a new sticker set owned by your bot and the user with createNewStickerSet method. I was wondering if you can delete the sticker set too because I can't find any method specifying that in the wiki
Detete all the stickers out of the pack so it's just a dead pack, it will disappear after about an hour
In Python-telegram-bot how to get, if possible, the complete list of all participants of the group at which the bot was added?
You can't with current API but you could the join/exit of user members via it's API.
If you check the Message object you find :
new_chat_participant: A new member was added to the group, information about them (this member may be the bot itself)
left_chat_participant: A member was removed from the group, information about them (this member may be the bot itself)
So with this two information you can track the total number of users in your chat and who they are.
The basic strategy would be to store somewhere (like a database) the occurrences of joining and exiting of users from the group.
When a user join the chat store the object User to the storage.
When a user exit the chat delete the object User from the storage.
Well then do the logic as you need.
Also, latest API update allows you to:
telegram.get_chat_members_count(chat_id): Use this method to get the number of members in a chat.
telegram.get_chat_member(chat_id, user_id): Use this method to get information about a member of a chat.
You can combine with new_chat_participant and left_chat_participant strategy, to build information about a group.
More information here:
https://python-telegram-bot.readthedocs.io/en/stable/telegram.bot.html#telegram.Bot.get_chat_members_count
https://python-telegram-bot.readthedocs.io/en/stable/telegram.bot.html#telegram.Bot.get_chat_member
As stated by the others before, it's not possible with the bot API (for now) hence you have to go the telegram API way. Start via https://core.telegram.org/api/obtaining_api_id
I had the same problem and solved it via telethon. A snipped for you to start from:
from telethon import TelegramClient
import asyncio
api_id = 1234 # Your API_ID
api_hash = "1a2b3c456" # Your APP_ID
bot_token = "87319a123b12e321ab1cd" # (via botfather, you can alternatively sign in as a user)
goupid = -120304101020
async def get_users(client, group_id):
async for user in client.iter_participants(group_id):
if not user.deleted:
print("id:", user.id, "username:", user.username)
bot = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token)
with bot:
asyncio.get_event_loop().run_until_complete(get_users(bot, group_id))
(Example via https://gist.github.com/rokibhasansagar/d727fb30ef5a274cf536bea73260887c)
Is it possible to map the method name to a header with a int-http:inbound-gateway? for example:
<int-http:inbound-gateway request-channel="requests" reply-channel="replies"
supported-moethds="GET,PUT"
path="/user">
<int-http:header name="requestMethod" expression="#requestMethod"/>
</int-http:inbound-gateway>
<!-- ... -->
<int:header-value-router input-channel="requests" header-name="requestMethod>
<int:mapping value="GET" channel="getUserRequests"/>
<int:mapping value="PUT" channel="addUserRequests"/>
</int:header-value-router>
Furthermore, I see examples that utilize #requestParams, but the javadoc for 2.1 mentions #queryParameters, and I don't see documentation for either of these in the official documentation page. Do you guys know a good resource that describes not only how SpEL parses expressions but what fields are available to use with it? All I can tell is I have headers, payload, #pathVariables, and maybe #requestParams or #queryParams, along with any other #beans I have defined in the current context.
Thanks in advance!
That method is always mapped to a header
... http_requestMethod=POST ...
Message<?> message = messageBuilder
.setHeader(org.springframework.integration.http.HttpHeaders.REQUEST_URL, request.getURI().toString())
.setHeader(org.springframework.integration.http.HttpHeaders.REQUEST_METHOD, request.getMethod().toString())
.setHeader(org.springframework.integration.http.HttpHeaders.USER_PRINCIPAL, servletRequest.getUserPrincipal())
.build();
The javadoc is wrong. The two additional variables are #requestParams and #pathVariables.