Get users' email with Jira Python Library - python-3.x

I've been trying to get the email of a Jira user other than my own with the Python3 Jira library, but couldn't do it. It either gives me an error, saying I don't have enough permissions to get it, or only returns me simple information, like display names. Here's my code:
from jira import JIRA
conn = JIRA(
options={"server": "https://example.atlassian.net"},
basic_auth=("my.email#gmail.com", TOKEN),
)
conn.user(id='my_id').emailAddress # Returns my email and more information
conn.user(id='another_user_id').emailAddress # Doesn't return his email
How could I get someone's email?
And what kind of permissions could I need?

To access another user's email in Jira, you'll need to have the "View User" permission in Jira. You can check this by navigating to the Jira administration page, clicking on Users, and checking the permissions for the user you want to access. If you do not have the "View User" permission, you will not be able to retrieve the email address of another user.
If you do have the "View User" permission, but still cannot retrieve the email address, you could try the following code:
from jira import JIRA
conn = JIRA(
options={"server": "https://example.atlassian.net"},
basic_auth=("my.email#gmail.com", TOKEN),
)
user = conn.user(id='another_user_id')
email = user.emailAddress
print(email)
Note that the emailAddress property is only available in Jira versions 7.3 and later. If you're using an earlier version of Jira, you may need to upgrade to access this property.

Related

Get OneDrive data for Microsoft Azure Users

Trying to get response for https://graph.microsoft.com/v1.0/users/{user_id}/drives but get:
{'error': {'code': 'ResourceNotFound',
'message': "User's mysite not found.",}
Permissions is ok, user_id is correct
I tried to reproduce the error on my side, and found that, if I used ropc flow to generate an access token and used a different user id in request, it then returned 'User's mysite not found'. And if I used credential flow with a user id which doesn't has one drive license, it then returned that error. If I used correct user id which has one drive license, 200 code returned. And the api doc also mentioned that 'idOrUserPrincipalName string Required. The identifier for the user object who owns the OneDrive'
So my idea is check the user id if you used password flow to generate the access token and if not, you should make sure the user to tested via the api has the correct license.

No output for existing permissions on non-IBMid users?

I tried the example user permissions script at https://softlayer.github.io/python/set_permission/
It successfully lists existing user permissions for users with IBMids, but if I try a user without an IBMid, for example the account owner, or the brand master account, I get no output for existing permissions. Is this expected?
The specific section of code in the example script that lists permissions is:
def main(self, user_id):
permissions = self.client['User_Customer'].getPermissions(id=user_id)
print("=== OLD PERMISSIONS ===")
self.printPermissions(permissions)
#setperm = {'keyName': "TICKET_ADD"}
#self.client['User_Customer'].addPortalPermission(setperm, id=user_id)
#permissions = self.client['User_Customer'].getPermissions(id=user_id)
#print("=== NEW PERMISSIONS ===")
#self.printPermissions(permissions)
I'm specifically interested in the old (existing) permissions part. I have opened a ticket about this internally (ticket 57783823), and the recommendation was to come here first. Thanks for any help you can provide.
It is expected to get empty response when you trying to get permission of master and brand account, because it is by design.
To get all users into the account and their permissions use the following rest, with this rest, you will get all users, their child’s and the permissions.
Method:
GET
https://[username]:[apiKey]#api.softlayer.com/rest/v3.1/SoftLayer_Account/getUsers?objectMask=mask[id,parentId,firstName,lastName,permissions,childUsers]
finally, to get all available permissions you can use the following rest api:
Method: GET
https://[username]:[apiKey]#api.softlayer.com/rest/v3.1/SoftLayer_User_Customer_CustomerPermission_Permission/getAllObjects

Docusign Custom button throws Invalid email address error for correct email

I have a custom button in Salesforce that has the javascript code to generate the docusign parameter with template id and recipient list CRL. And using demo docusign account for testing purpose. Here, am using docusign Salesforce Connect and not API.
Eventhough my email address is correct, when I click on the docusign custom button, I am getting an error message as follows,
Error: Incorrect email address format. Verify the email address or
contact your administrator for the correct format
But the docusign param generated values are correct for the email address,
https://dsfs.cs62.visual.force.com/apex/DocuSign_CreateEnvelope?
CES=Medical+Release+Form.pdf&
RES=0%2C0%2C0%2C0%2C0%2C0&
DST=E1377257-80EB-4F3D-A046-A1D033CBD4F5&
DSEID=0&
LA=0&
SourceID=5005C000000UNG1&
CEM=Please+sign+the+forms+given&
OCO=Send&
CRL=Email~+kamatchidevi%40mstsolutions.com%3BLastName~+test+doc+%3BRole~Signer1
Thanks & Regards,
Kamatchi Devi
The + signs are causing the issue here, there is also no need to encode it yourself as it's done by the manage package into the URL. However, if you are going to URL encode I would recommend doing the entire string, like so
CRL = encodeURIComponent('Email~kamatchidevi#mstsolutions.com;LastName~test doc;Role~Signer1')

ASP.NET Identity 2 GenerateEmailConfirmationTokenAsync(user.Id) is there a timeout for the link generated?

I am using the most recent Identity 2 package in my MVC 5 program.
In the Register method of the Account controller when a user is registered. it sends an email to the user's email account with a link to click to verify the account.
I have found that If I create a dummy user and immediately check my email to register the account it verifies successfully.
If I wait on clicking on the link in the email, all I get is
Error.
An error occurred while processing your request.
Is there a time out on this email link? And if so is there anyway to extend the timeout of this link?
Since no one has provided an answer here, I will. The OP's problem was that no URL encoding the resulting token occurred.
var code = Url.Encode(await UserManager.GenerateEmailConfirmationTokenAsync(userId))
or
var code = HttpUtility.UrlEncode(await UserManager.GenerateEmailConfirmationTokenAsync(userId))
If you are encoding, check the lifespan.

Liferay find User screenName from User Email

Is there any api to find out screen name by passing the email address as the input in liferay for LDAP configuration?
You'll need to get a request object, then do this
long companyID = PortalUtil.getCompanyId(request)
User user = UserLocalServiceUtil.getUserByEmailAddress(companyID, emailAddress);
String scrName = user.getScreenName();
EDIT : in your liferay control panel/portal/authentication/LDAP, there is field named 'user search filter'
use (cn=#screen_name#) if your users are logging with screenName
use (mail=#email_address#) if your users are logging with email address
This way you're supposed to import the users automatically.
Please update your question. According to your tags, it looked like you're searching for a Liferay API. If you wanted an LDAP API you should write it somewhere

Resources