I want to remove some columns from table "User_" of Liferay Database (Lportal) as I don't want to store user's last login IP address. I know about Monitoring in Liferay but that can be turned off.
How can I stop Liferay from storing unnecessary details of user?
Oh, this is a different level than usual. First of all: You don't write directly to the database.
Now for the next level: You don't change the structure of the database. While there might be less of an argument not to add columns, you definitely never ever ever ever remove columns.
That out of the way: If it's just the last login that you want to get rid of, you edit your portal-ext.properties file and configure it. Liferay's default is
# Set this to true to record last login information for a user.
#
users.update.last.login=true
naturally, you'll set it to false. However, beware of LPS-51051, you might need to patch for this issue if you run into the described behavior.
Related
In our web application we want to use DB2 row level access control to control who can view what. Each table would contain a column named userId which contain the user id. We want log-in users be able to see only row's usereId column with theirs id. I have seen db2 permission examples using DB2 session_id or user, for example taking DB2 given Banking example :
CREATE PERMISSION EXAMPLEBANKING.IN_TELLER_ROW_ACCESS
ON EXAMPLEBANKING.CUSTOMER FOR ROWS WHERE BRANCH in (
SELECT HOME_BRANCH FROM EXAMPLEBANKING.INTERNAL_INFO WHERE EMP_ID = SESSION_USER
)
ENFORCED FOR ALL ACCESS
ENABLE;
Our table gets updated dynamically hence we don't know what row get added or deleted hence we don't know what are all the user Id in the table.
At any given time, different user would log-on to the web to view information retrieve from the tables, the permission declaration above only take SESSION_USER as the input, can I change it to something like Java function parameter where one can pass arbitrary id to the permission? If not then how do I handle different log-in users at arbitrary time? Or do I just keep changing SESSION_USER dynamically as new user login (using "db2 set" ??)? If so then is this the best practice for this kind use case?
Thanks in advance.
Since the user ID in question is application-provided, not originating from the database, using SESSION_USER, which equals to the DB2 authorization ID, would not be appropriate. Instead you might use the CLIENT_USERID variable, as described here.
This might become a little tricky if you use connection pooling in your application, as the variable must be set each time after obtaining a connection from the pool and reset before returning it to the pool.
Check out Trusted Contexts, this is exactly why they exist. The linked article is fairly old (you can use trusted contexts with PHP, ruby, etc. now).
So I was working on a Siebel change a client requested and had to test whether it worked fine. Since we weren't given permissions to edit certain things from Siebel itself, we had to go directly to the database (some records became read-only).
We have an Applet that listed the user's "Actions" in a view. Prior to modifying data from the database, the sort worked fine. You could enter a record and then it became read-only. I accessed the database and modified the dates for testing and to my surprise, Siebel no longer sorted the list correctly. The database (SQL Server) sorted just fine by date, but Siebel would do the following.
Date sort (shown in Siebel)
10/20/2014
10/25/2014
10/18/2014
10/17/2014
10/16/2014
10/15/2014
Date sort (shown in Database)
10/25/2014
10/20/2014
10/18/2014
10/17/2014
10/16/2014
10/15/2014
Not only is this restricted to the applet itself but to what Business Services retrieve. We checked in the applet and BC but could not find any sort specification or any code of the sort that could cause this. It's like the sorting order depending upon that date field is cached in Siebel.
Any ideas on why this could be?
That order doesn't make any sense. I wouldn't blame cache in this case, I'd rather say that Siebel is ordering the data based on another field/column, different from the one that you updated and see in the applet.
You can see what's actually going on by enabling the SQL spooling, which will generate a big log with every SQL statement executed. The easiest way to do so is using a dedicated/developer/thick web client. You just have to add the /s parameter in your shorcut's command line. For example:
"D:\Siebel\Client\bin\siebel.exe /c D:\Siebel\publicsector.cfg /s D:\sql_trace.log"
If you don't have access to a dedicated client, you can enable the spooling on the server too. Or, you can monitor the database, if SQL Server provides something similar to the Oracle management console.
Using any of these methods you should be able to determine the exact SELECT that Siebel is running when you access the business component. My guess is that the ORDER BY column won't be the one that you updated.
Which Business Component is this ? Is it Action ? Please check the BC User Property "All Mode Sort" for this BC. If it is set to TRUE, it will ignore whatever searchspec you provide an sort by the U1 Index. The U1 index for S_EVT_ACT table (Action) is ACTIVITY_UID, so it will sort on this and not on dates.
I've got a large amount of access databases that need to have the same table design changes (and a few new tables created) in each of them. Is there any way to take my most recent (properly designed) database, export the design properties, and import them to each of the other databases overwriting changes and creating any new fields, tables, etc. as needed?
My research has only led me to the Database documenter which seems to only be helpful in cases where I'd manually update the properties. I also know I could potentially copy each table over manually specifying 'Structure Only' for each case but that'd be a rather daunting task and I'm unsure what exactly would be copied using this method.
Let me see if I have the outline...
Open Proper.mdb
For each OtherMDB in Folder1
Open OtherMDB
for each ProperTable in Proper.mdb
If ProperTable is absent from OtherMDB
Add ProperTable to OtherMDB
Else
For each Field in ProperTable.Fields
If ProperField is absent from OtherTable.Fields
Add Field to OtherTable
Elseif ' is this a possibility?? wanting to change field type?
ProperField.Type <> OtherTable.Field("xx").Type Then
Change Field.Type
endif
Next Field
Endif
Next Table
Close OtherMDB
Next MDB
I found a utility called DBWeigher which is able to analyze and compare two access databases and automatically generate the necessary VBcode to update the changes between the two. From here I quickly ran through the changes manually and was able to see firsthand what changes would be made prior to running them through the DBConsole.
For anyone trying to update older access databases (especially when they're at different stages and could have some variances), I can't suggest checking this lightweight utility out.
I haven't had this problem until I first tried to manually add data to a database since my upgrade to WebMatrix 3, so I don't know if this is a bug or some kind of fault prevention.
I have defined a very simple table with the primary key as int and set it to not allow nulls, and be of the type IsIdentity so that the int value will automatically increment, as needed.
A pic of that is shown here:
Okay, seems simple enough, but when I try to manually add data to the table, it, as it should, does NOT allow me to modify the primary key value in any way (because it is automatic).
All I do is put in a couple of string values to the type and location columns and it tells me that it couldn't commit changes to the database because of the invalid value in the primary key field (it acts as though it is gonna try to throw NULL in as the value, but this should be overridden when it automatically adds the row. The user-interface does not allow me to control or edit this value in anyway).
A pic of this is shown here:
What is this? Some kind of bug? Is it a new rule that WebMatrix does not allow a developer to add values to the database manually? Do I have to write a query every time I want to add something to the database? Am I in the Twilight Zone? (Okay, sorry about the last one...)
Also, I've noticed that if I don't have IsIdentity set, I can edit the field, put a PERFECTLY VALID integer therein, and it still errors the same way, so I use ESC to backup my changes, then hit refresh, only to find that it did, indeed, add the row anyway :/ . So, this interface seems kind of buggy to begin with. In my scenario above (using IsIdentity), it DOES NOT add the row anyway, unfortunately.
--------------------UPDATE--------------------------
I just recently downloaded a WebMatrix update, and it appears that they have fixed this! Yay! (till now I was just querying generic INSERT INTO statements and editing them manually from there).
I think the SQL CE tooling with WM3 is broken, suggest you look at other tools for editing data - I can recommend the standalone SQL Server Compact Toolbox (disclosure: I am the author)
I haven't been able to find any information regarding the best way to handle record editing with approval in CakePHP.
Specifically, I need to allow users to edit data in a record, but the edited data should not overwrite the original record data until administrators have approved the change. I could put the edited records in a new table and then overwrite the originals when I approve them but I wonder if there is an easier way since this idea doesn't seem to play well with the cake philosophy so to speak.
You are going to need somewhere to store that data until an administrator can approve it.
I'm not sure how this can be easier than creating another table with the new edits and the original post id. Then when an administrator approves the edit, the script overwrites the old record with the edited version.
I'm working on a similar setup and I'm going with storing the draft record in the same table but with a flag set on the record called "draft". Also, the original record has a "draft_id" field that has the id of the draft record stored in it.
Then in the model when the original record is loaded by the display engine it shows it normally. But when the edit or preview actions try to load the record, it checks the "draft_id" field and then loads the other record if it's set.
The "draft" flag is used to keep list and other group find type actions from grabbing the draft records too. This might also be solved by a more advanced SQL query but I'm not quite that good with SQL.