I want to store an structure similiar to this.
The idea is make possible extract all the descriptions with the same id, I didnt see many examples in reddis, the documentation is very basic I think. Someone can tell me?
user:id:12:description:"nice"
user:id:12:description:"bad"
user:id:15:description:"nothing_especial"
...
I know that this is possible with hset, I tried with something like:
hset user id 12
hset user description "nice"
...
but the problem is that, when I try to insert the same key different times, HSET override the content value, and finally I have the same but with a different value
In the documentation I saw an example but was with Set, was something like this (i dont understand why they user a simple set....):
$ redis-cli set news:1:title "Redis is simple"
OK
$ redis-cli set news:1:url "http://code.google.com/p/redis"
OK
$ redis-cli lpush submitted.news 1
I made this, At first I thought about this, but its limited because I cannot have more thatn one description for every user:
hset user id:1:deal "yeaaaaaaaah"
hset user id:1:description "sometifjjapodsifj"
hget user id:1:deal
>yeaaaaaaaah
hget user id:1:description
>sometifjjapodsifj
Finally the solution was this:
hset user1 description1 "asdoifjasdpofjaspdo"
hset user1 description2 "aosdifj"
hset user2 description1 "asdoijfaodsifj"
hset user2 description2 "asdoifjaposdifjaposdifjasdf"
hgetall user2
>description1=asdoijfaodsifj
>description2=asdoifjaposdifjaposdifjasdf
Related
I'm pretty sure that last week I was able to use Get-AzADUser to return both Department and AccountEnabled.
Get-AzADUser | where {$_.Mail -eq "abc#xyz.com"} | Select-Object Mail, Department, AccountEnabled
Mail Department AccountEnabled
---- ---------- --------------
abc#xyz.com
When I call up all parameters for a single user I can see that I'm missing content on many fields, I basically only see Name, JobTitle, Mail, and MobileNumber
I'm using an account assigned the roles "Global reader" and "Directory readers".
(Other parts of my script also stopped working since last week where Get-AzADUsers no longer has a field called "ObjectId" but instead the field is simply called "Id")
You need to use "-Select" and " -AppendSelected" parameters to get the info.
Try the following (working for me)...
Get-AzADUser -Select 'Department,AccountEnabled' -AppendSelected -UserPrincipalName "abc#xyz.com" | Select-Object Mail, Department, AccountEnabled
Mail Department AccountEnabled
---- ---------- --------------
abc#xyz.com IT Support True
More info: https://learn.microsoft.com/en-us/powershell/module/az.resources/get-azaduser
I tested in My Environment and found Get-AzADUser not much suitable command as it doesn't appear to return any information about the user (like department, usage location, office info, or basically any properties on the user).
There continues to be a lack of properties returned when comparing Get-AzureADUser vs. Get-AzADUser:
AzureAD Module which is a designed for tasks within AzureAD
Where second one Az which is designed to handle most, if not all of Azure's resources.
you can use the az module easliy if you just want to look up the users existance, but if you need to actually administer azure ad i would suggest you go for azuread. To connect to a specified tenant with azuread use connect-azuread -tenantId 'XXXXXX'.
Output Using Get-AzureADUser
I am able to get the departmentName
Reference : https://github.com/Azure/azure-powershell/issues/10497
I just started Redis. I need to create a database for online store or whatever. Main idea to show functionality. I never worked in Redis and terminal, so a bit confusing. Firstly I want to create a database of users with id users counter:
SET user:id 1000
INCR user:id
(integer) 1001
Can I use somehow command in command like:
HMSET incr user:id username "Lacresha Renner" gender "female" email "renner#gmail.com"
(error) ERR wrong number of arguments for HMSET
in case that my database automatically count new users in database. Or it's not possible in Redis? Should I do it by hands, like user:1, user:2, user:n?
I am working in terminal (MacOS).
HMSET receives a key name, and pairs of elements names and values.
Your first argument (incr) is invalid, and the id part of the second should be explicit id.
e.g.:
HMSET user:1000 username "Lacresha Renner" gender "female" email "renner#gmail.com"
Regarding your first SET, you should have one key that its whole purpose is a running uid, you should use the reply of INCR as the new UID for the new user HASH key name (1000 in the above example).
If you never delete users, the value of the running UID will be the number of users in your system. If you do delete users, you should also insert the UID into a SET and remove the UID once you delete the user. In that case, an SCARD should give you the number of users in your system, and SMEMBERS (or SSCAN) will give you all of their UIDs.
Currently I can do this in powershell via this script:
Search-ADAccount –LockedOut -SearchBase 'OU=location,OU=country,DC=company,DC=com' | ft Name, SamAccountName, LastLogonDate
I would rather have it in a LDAP saved query, I found this one to display all locked out accounts in the company:
(&(&(ObjectCategory=Person)(ObjectClass=User)(LockoutTime>=1)))
I have tried a number of combinations, but I can't seem to get it right. Here is one of them:
(&(&(ObjectCategory=Person)(ObjectClass=User)(memberof=OU=location,OU=country,DC=company,DC=com)(LockoutTime>=1)))
What am I doing wrong?
As information, when you create a new query, you have the option of specifying the "query root"... by drilling down with that, I was able to achieve the desired goal. I didn't have to modify the query string at all.
Is it possible in CakePHP 1.3 to login a user by indicating the user's id in the users table?
Now, to do a "manual" login, I do this (which works):
$this->data['User']['username'] = username;
$this->data['User']['password'] = password;
$this->Auth->login($this->data);
I would like to be able to indicate the specific user, for example adding $this->data['User']['user_id'] before the login() function. (I've tried that but it doesn't work).
The reason I want to do this is because in the users table there are different users records of users who have the same username and password. It seems odd but in my case makes sense, since one same user may create several accounts for different reasons, and he may choose the same username/password.
Any ideas would be much appreciated!
EDIT:
I'm going to give a specific example of what I'm trying to do, maybe it helps to bring some ideas.
Say I have this 2 records in the users table (fields are user_id / username / password / account_id):
Record 1: 1 / johndoe / password1 / 10
Record 2: 2 / johndoe / password1 / 15
So this 2 records have same username and password, but different user_id and account_id. When the login is processed, I know what account_id the user has chosen. So I want to log in the corresponding user. So if the user chooses account 15, then logs is, I should be logging in the user with id 2.
However, the way cake's login works, it always retrieves the first record that matches username / password. In this example, cake would be logging in the user with id 1.
Is there any way I can do what I want?
Doesn't sound like a very good idea to me, but if you really want/must do it that way, then have a look at AuthComponent::userScope. You can use it to define additional conditions for authentication lookups, for example:
$this->Auth->userScope = array('User.account_id' => 15);
That way authentication would only be successful when username and password match and the users account_id is 15, ie the resulting query would look something like this
User.username = 'abc' AND User.password = 'xyz' AND User.account_id = 15
In the documentation is said that you can use hash to store objects or any kind of data, and later you can extract them. I want to save, for instance, ids from a few users by using hash, and later extract all the ids, or all the elements with ids (something, I didnt accomplish nothing similar), can you help me?
redis 127.0.0.1:6379> set user:id:1234 "content of my first user"
OK
redis 127.0.0.1:6379> set user:id:1235 "content of my second user"
OK
redis 127.0.0.1:6379> set user:id:1236 "content of my third user"
OK
redis 127.0.0.1:6379> get user:id
(nil) ####I hoped to see all my id's users listed, I want to make
something like that,in the documentation I saw an example, but
is not completed####
Those are plain top-level key sets. To make a hash, you should use HSET
hset user:id 1234 "content of my first user"
hset user:id 1235 "content of my second user"
hgetall user:id