Dear Ahmed,
I have asked you this question before. HOW can I add more than one owner
to the record. I tried manually adding two records in membership_userrecords
table with different members but still it did not work. I guess small changes
needed to be done in PHP Coding that we make appgini to recognize multiple
owners.
Your help in this matter is highly appreciated.
Adding more than one owner to the record. Please Help!
Re: Adding more than one owner to the record. Please Help!
Hi Almaqdad,
Although the structure of the "membership_userrecords" table does allow multiple owners for each record, the generated code is written in a manner to support only one owner per record. I'll try to review the code to see if supporting more than one record owner is possible in all scenarios and if so, I'll make this change in future releases.
Although the structure of the "membership_userrecords" table does allow multiple owners for each record, the generated code is written in a manner to support only one owner per record. I'll try to review the code to see if supporting more than one record owner is possible in all scenarios and if so, I'll make this change in future releases.
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
Re: Adding more than one owner to the record. Please Help!
is there any update on this?
-
- AppGini Super Hero
- Posts: 85
- Joined: 2014-06-14 03:08
- Location: India
- Contact:
Re: Adding more than one owner to the record. Please Help!
Hi,
This a great feature that would help lot of people.
You can get this working with this few steps.
Step 1. There is a key ''tableName_pkValue" in membership_users table, that will not allow you to insert multiple records for same primary key and table name. So drop that key
DROP index tableName_pkValue on membership_users
Step 2: There is a line in incFunctions.php file that will create the index even if you drop it, So remove that line.
The line will look something like this
By Now the user(2nd or 3rd user) who have permission to a record should see the records in table view. 50% Done.
Step 3: You need to do this in every table file. Here my table name is employees. So in employees_dml.php file i modified 2 lines from
to
Done. I hope this helps.
I tried this and got this working, haven't seen any side effects.
May be ahmad can put this into his build if he feels it wont inject any new issues.
This a great feature that would help lot of people.
You can get this working with this few steps.
Step 1. There is a key ''tableName_pkValue" in membership_users table, that will not allow you to insert multiple records for same primary key and table name. So drop that key
DROP index tableName_pkValue on membership_users
Step 2: There is a line in incFunctions.php file that will create the index even if you drop it, So remove that line.
The line will look something like this
Code: Select all
if(!$membership_userrecords['tableName_pkValue'][1] || !$membership_userrecords['tableName_pkValue'][2]) @db_query("ALTER IGNORE TABLE membership_userrecords ADD UNIQUE INDEX tableName_pkValue (tableName, pkValue)");
Step 3: You need to do this in every table file. Here my table name is employees. So in employees_dml.php file i modified 2 lines from
Code: Select all
$ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."'");
$ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."'");
to
Code: Select all
$ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."' and groupID=".getLoggedGroupID());
$ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."' and memberID=lcase('".getLoggedMemberID()."')");
I tried this and got this working, haven't seen any side effects.
May be ahmad can put this into his build if he feels it wont inject any new issues.
-
- Posts: 27
- Joined: 2015-12-19 03:59
Re: Adding more than one owner to the record. Please Help!
I tried and its work for stamdard or parent table, but the problem still exist in child table,can anyone help please?udayvatturi wrote:Hi,
This a great feature that would help lot of people.
You can get this working with this few steps.
Step 1. There is a key ''tableName_pkValue" in membership_users table, that will not allow you to insert multiple records for same primary key and table name. So drop that key
DROP index tableName_pkValue on membership_users
Step 2: There is a line in incFunctions.php file that will create the index even if you drop it, So remove that line.
The line will look something like thisBy Now the user(2nd or 3rd user) who have permission to a record should see the records in table view. 50% Done.Code: Select all
if(!$membership_userrecords['tableName_pkValue'][1] || !$membership_userrecords['tableName_pkValue'][2]) @db_query("ALTER IGNORE TABLE membership_userrecords ADD UNIQUE INDEX tableName_pkValue (tableName, pkValue)");
Step 3: You need to do this in every table file. Here my table name is employees. So in employees_dml.php file i modified 2 lines fromCode: Select all
$ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."'"); $ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."'");
to
Done. I hope this helps.Code: Select all
$ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."' and groupID=".getLoggedGroupID()); $ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='employees' and pkValue='".makeSafe($selected_id)."' and memberID=lcase('".getLoggedMemberID()."')");
I tried this and got this working, haven't seen any side effects.
May be ahmad can put this into his build if he feels it wont inject any new issues.
-
- AppGini Super Hero
- Posts: 336
- Joined: 2015-12-23 16:52
Re: Adding more than one owner to the record. Please Help!
Conceptually, record ownership by more than one user is awkward, and usually attempts to render awkward concepts in code result in awkward software.
How does a record gain more than one owner? For example, if it is created by John, how do Paul, George and Ringo also become owners? Does John grant it? Do they find the record themselves and then lay claim to it? Does an admin have to be petitioned to do everything? How does the system know if a request to own a record is exclusive or shared? Who removes a co-owner? Etc.
It might be easy to hack something together, but to make a robust system that is understandable to everyone (as AppGini must do), and have it work reliably in whatever unique scenario it's used in (as AppGini must do) -- that's much more challenging.
I think the entire security model needs to be reworked. Better Ahmad to do that than to spend his limited time whacking out individual hacks.
How does a record gain more than one owner? For example, if it is created by John, how do Paul, George and Ringo also become owners? Does John grant it? Do they find the record themselves and then lay claim to it? Does an admin have to be petitioned to do everything? How does the system know if a request to own a record is exclusive or shared? Who removes a co-owner? Etc.
It might be easy to hack something together, but to make a robust system that is understandable to everyone (as AppGini must do), and have it work reliably in whatever unique scenario it's used in (as AppGini must do) -- that's much more challenging.
I think the entire security model needs to be reworked. Better Ahmad to do that than to spend his limited time whacking out individual hacks.
-
- Posts: 27
- Joined: 2015-12-19 03:59
Re: Adding more than one owner to the record. Please Help!
latest update about this what i got is when you add data from child table it will broke a membership_userrecords table (its awkward just like grimblefritz say
any idea about this?
any idea about this?
-
- Veteran Member
- Posts: 35
- Joined: 2016-02-16 22:31
Re: Adding more than one owner to the record. Please Help!
Hi
I tried adding more than one owner to the record using Udayvatturi method, my AppGini Version 5.81, but looks like code incFunctions.php was change.
Using keywords tableName_pkValue and membership_userrecords I find:
I need adding more than one owner to record table: projects_dml.php
Please help, what I need to change at incFunctions.php file to have more than one owner for one record.
I tried adding more than one owner to the record using Udayvatturi method, my AppGini Version 5.81, but looks like code incFunctions.php was change.
Using keywords tableName_pkValue and membership_userrecords I find:
Code: Select all
########################################################################
function update_membership_userrecords() {
$tn = 'membership_userrecords';
$eo = array('silentErrors' => true);
sql(
"CREATE TABLE IF NOT EXISTS `{$tn}` (
`recID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`tableName` VARCHAR(100),
`pkValue` VARCHAR(255),
`memberID` VARCHAR(100),
`dateAdded` BIGINT UNSIGNED,
`dateUpdated` BIGINT UNSIGNED,
`groupID` INT UNSIGNED,
PRIMARY KEY (`recID`),
UNIQUE INDEX `tableName_pkValue` (`tableName`, `pkValue`(150)),
INDEX `pkValue` (`pkValue`),
INDEX `tableName` (`tableName`),
INDEX `memberID` (`memberID`),
INDEX `groupID` (`groupID`)
) CHARSET " . mysql_charset,
$eo);
sql("ALTER TABLE `{$tn}` ADD UNIQUE INDEX `tableName_pkValue` (`tableName`, `pkValue`(150))", $eo);
sql("ALTER TABLE `{$tn}` ADD INDEX `pkValue` (`pkValue`)", $eo);
sql("ALTER TABLE `{$tn}` ADD INDEX `tableName` (`tableName`)", $eo);
sql("ALTER TABLE `{$tn}` ADD INDEX `memberID` (`memberID`)", $eo);
sql("ALTER TABLE `{$tn}` ADD INDEX `groupID` (`groupID`)", $eo);
sql("ALTER TABLE `{$tn}` CHANGE COLUMN `memberID` `memberID` VARCHAR(100)", $eo);
}
Please help, what I need to change at incFunctions.php file to have more than one owner for one record.
-
- Veteran Member
- Posts: 32
- Joined: 2013-03-22 13:31
Re: Adding more than one owner to the record. Please Help!
has there been a development on this? I have a very big need for different users to have access to the same records.