We access an application from another using DbColumn ( I want to access a view from another database ) and for the dbname we are using:
`var a = "domain/company" + "!!" + "MyBase.nsf"`
#Unique(#DbColumn(a, "vwMy", 0)
We changed from http to https and we have an error now: for SelectItems. DbColumn is used within a combobox.
how can I acces another database other way? So that it can work using https also.
I've added the following code:
var dbname = "";
if(#ClientType()=="Notes"){
dbname = "server/Company" + "!!" + "MyBase.nsf";
}
else if (#ClientType()=="Web"){
dbname = session.getServerName() + "!!" + "MyBase.nsf";
}
It looks that specifying it in a string "server/Company" didn't work in my case when I'm using it on the browser.
Also it seems the https hadn't influence this approach.
If you want to access another database on the same server you can use
#Unique(#DbColumn("names.nsf"($PeopleGroupsFlat)", 2))
Related
Is there a way to get the value of the mail file field from the (Company)' Directory ? I wrote a code to get the value but it is not the same in all situation.
Here is the code:
var firstChar = context.getUser().getFullName().charAt(0);
var lastWord = context.getUser().getFullName().split(" ").pop();
var str = firstChar+lastWord;
var str2 = str.slice(0, 8);
var link = "https://server/mail/";
link +=str2+".nsf/iNotes/Mail/?OpenDocument&ui=portal";
return link;
You can access the server directory as any other Notes database. Unless additional address books are there, the user should exist under their username in the "($Users)" view. From there you can retrieve the mail file and server. If it's different from the current server, you may need to check the relevant server document for the hostname.
Borrowing an example from the documentation on the NotesDirectory class and modifying for your purposes, I'd try something like:
var mynotesdir:NotesDirectory = session.getDirectory("server name");
var homeserver = mynotesdir.GetMailInfo("Joe Smith", True);
var mailFileName = homeserver[3];
var link = "https://server/mail/" + mailFileName + "/iNotes/Mail/?OpenDocument&ui=portal";
return link;
The syntax may be wrong, as I copied it from an example and modified it here instead of in Designer, but this should still serve as a good start.....
I am trying to connect to the Preview Azure Redis Cache with the following code.
var options = new ConfigurationOptions();
options.EndPoints.Add("myname.redis.cache.windows.net", 6379);
options.Ssl = true;
options.Password = "VeryLongKeyCopiedFromPortal";
var connection = ConnectionMultiplexer.Connect(options);
When I do this I get the exception
"It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail"
What can be causing this?
The port for SSL is 6380. Port 6379 is used for non-SSL. StackExchange.Redis defaults to these ports if not set, so you should be able to just remove the port from your code, like so:
var options = new ConfigurationOptions();
options.EndPoints.Add("myname.redis.cache.windows.net");
options.Ssl = true;
options.Password = "VeryLongKeyCopiedFromPortal";
var connection = ConnectionMultiplexer.Connect(options);
Alternatively, you can use a connection string instead of the ConfigurationOptions object:
var connection = ConnectionMultiplexer.Connect(
"myname.redis.cache.windows.net,ssl=true,password=VeryLongKeyCopiedFromPortal");
I had this same issue. Make sure you copied the key correctly :)
My issue was I didn't copy the base 64 encoded key properly from the UI. Consider the two keys below. The way I usually copy/paste a non broken string is by double clicking. When I double clicked on the key I got the first set of data and not the entire string.
8Rs0Uvx7aaaaaaaaTjaoTu11bz0qOm/o5E8dtWPXtrc=
8Rs0Uvx7aaaaaaaaTjaoTu11bz0qOm
from local in C#, you can use like this ...
"localhost, port:6379, password=value"
I am trying to create a new user -> set password and enable account .
earlier i was using 1 single object , but after looking at a few posts i decided to use 'using' for 3 different operations
string strDisplayName = txtFirstName.Text + " " + txtLastName.Text;
string strUser = txtLoginName.Text;
string pw = "pass#123";
using (var objADAM = new DirectoryEntry("LDAP://" + adlink + "/CN=Users,DC=SS,DC=COM", "ss\\luser", "pass#123", AuthenticationTypes.Secure))
{
const long ADS_OPTION_PASSWORD_PORTNUMBER = 6;
const long ADS_OPTION_PASSWORD_METHOD = 7;
const int ADS_PASSWORD_ENCODE_CLEAR = 1;
string strPort = "389";
int intPort = Int32.Parse(strPort);
using (var objUser = objADAM.Children.Add("CN=" + strUser, "user"))
{
objUser.Properties["sAMAccountName"].Add(strUser);
objUser.CommitChanges();
}
}
using (var user = new DirectoryEntry("LDAP://" + adlink + "/CN=" + strUser + ",CN=Users,DC=SS,DC=COM", "ss\\rluser", "pass#123"))
{
user.Invoke("SetPassword", new object[] { "password" });
user.CommitChanges();
}
using (var user = new DirectoryEntry("LDAP://" + adlink + "/CN=" + strUser + ",CN=Users,DC=SS,DC=COM", "ss\\rluser", "pass#123"))
{
//Enable account and change password on first logon flag
user.Properties["userAccountControl"].Value = 0x200;
user.Properties["pwdLastSet"].Value = 0;
user.CommitChanges();
}
I must mention, that i am outside the domian, and trying to connect to a remote AD on another domain . The credential's passed however are the ADMIN
The user creation goes on smoothly (after some hiccups with port opening & LDAP connections) , but the issue occurs when the invoke ->setpassword is called .
The error is :"the RPC server is unavailable " , just to make sure i am not doing something wrong in my code, i downloaded a LDAP admin tool and tried to reset the password of an existing user ->same error
steps
-checked the RPC service running
-opened RPC ports -135 ,blah blah..basically every port there is to open :|
any help is appreciated .
Thanks
Rajat
For example:
DirectoryEntry de = new DirectoryEntry();
de.Path = "LDAP://dnsname.domain.com:389/OU=Companies;
Microsoft recommends accessing using DNS.
if the machine you are accessing is connected to a different domain, you must specify it as "ip dnsname" in the hosts file in the "C:\Windows\System32\drivers\etc " directory.
using adlink is string domain, because AD method Invoke using domain name: "abc.com"
Filepicker by default allows pretty much everybody to add files to your S3 bucket who was clever enough to copy your API key out of the client code and luckily also offers a security option with expiring policies.
But I have no idea how to implement this in Meteor.js. Tried back and forth, installing meteor-crypto-base package, trying to generate the hashes on the server, tried RGBboy's urlsafe-base64 algorithm on https://github.com/RGBboy/urlsafe-base64. But I just do not get any further. Maybe someone can help! Thank you in advance.
This is an example of how to do filepicker signed URLs in meteor, based on the documentation here:
var crypto = Npm.require('crypto');
var FILEPICKER_KEY = 'Z3IYZSH2UJA7VN3QYFVSVCF7PI';
var BASE_URL = 'https://www.filepicker.io/api/file';
Meteor.methods({
signedUrl: function(handle) {
var expiry = Math.floor(new Date().getTime() / 1000 + 60 * 60);
var policy = new Buffer(JSON.stringify({
handle: handle,
expiry: expiry
})).toString('base64');
var signature = crypto
.createHmac('sha256', FILEPICKER_KEY)
.update(policy)
.digest('hex');
return BASE_URL + "/" + handle +
"?signature=" + signature + "&policy=" + policy;
}
});
Note this will need to exist somewhere inside of your server directory so you don't ship the key to the client. To demonstrate that it works, on the client side you can call it like so:
Meteor.call('signedUrl', 'KW9EJhYtS6y48Whm2S6D', function(err, url){console.log(url)});
If everything worked, you should see a photo when you visit the returned URL.
I have code in the afterRenderReponse event in an xpage (xagent) to establish a connection with the Domino Data Service and return the result (json) to a scoped variable.
Anonymous access to the database containing the xpage is No Access, so the user will have to log in.
Problem is that when calling url.openConnection() in the code, the login form is returned. Meaning I have to authenticate again even if the requested url is at the same server/domain as the xpage calling it.
I know I can authenticate using basic authentication using:
conn.setRequestProperty("Authorization", "Basic " + authStringEnc) , but then I would have to know the username and password + base64 encode this.
My question is : Since the user is allready authenticated, is it possible to "pass along" these credentials to the java.net.HttpURLConnection object ? Is it possible to get a handle to the ltpatoken cookie and provide this ? Any other way ?
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false">
<xp:this.afterRenderResponse><![CDATA[#{javascript:// Establish connection with Domino database collection resource
try{
var url = new java.net.URL("http://server/mydb.nsf/api/data");
var conn:java.net.HttpURLConnection = url.openConnection();
conn.setRequestProperty("Accept", "application/json");
if (conn.getResponseCode() == "200") {
// Get the response
var reader = new java.io.BufferedReader(new java.io.InputStreamReader(conn.getInputStream()));
var buffer = new java.lang.StringBuffer();
var line = "";
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
reader.close();
// Create array from response
var jsonarray = eval('(' + buffer + ')');
// Get filenames and titles from Domino database collection resource
// On XPage, requestScope.status is bound to a multi-line text control
for (var i = 0; i < jsonarray.length; i++) {
requestScope.status += jsonarray [i].#filepath + " - " + jsonarray [i].#title + "\n";
}
} else { // if connection fails
requestScope.status = conn.getResponseCode() + " " + conn.getResponseMessage();
}
} catch(e){
_dump(e);
}
}]]></xp:this.afterRenderResponse>
</xp:view>
Any information would be greatly appreciated !
Thanks !
Best regards,
Petter Kjeilen
If the user is authenticated and you're using session authentication on the server, you can read the session cookies from the users and pass the same cookies along with subsequent (GET) requests.
Depending on how session authentication is configured on the Domino server, you're looking for the DomAuthSessionId or LTPAToken cookie. Have a look at the answer on this page for a sample on how to read the cookies and send them along with additional requests ("maintaining the session" section).
Don't use an HTTP URL Connection! Too much headache. Use the Apache HTTP Client. The classes are on the Domino server. Use this as a reference point how to use it.