logo
down
shadow

How can I check if a specific user has specific access rights on a folder/file in Delphi


How can I check if a specific user has specific access rights on a folder/file in Delphi

Content Index :

How can I check if a specific user has specific access rights on a folder/file in Delphi
Tag : delphi , By : user161314
Date : December 01 2020, 04:55 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Is there a way to check if a user has specific rights?


Tag : .net , By : SpittingCAML
Date : March 29 2020, 07:55 AM
this one helps. Short answer: LsaEnumerateAccountRights
I don't know if .NET provides a wrapper class, though.

Inno Setup - How to give one specific user rights to a folder


Tag : windows , By : Debashree
Date : March 29 2020, 07:55 AM
Does that help I must say that I find this quite suspicious. Users should not have write permissions to application installation folder. If the application needs to store some data, it should write them to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).
See also Application does not work when installed with Inno Setup.
[Run]
Filename: "cacls"; Parameters: """{app}"" /g John:w"; Flags: runhidden

How to check all access rights for specific user in Azure SQL Database?


Tag : azure , By : qba73
Date : March 29 2020, 07:55 AM
I hope this helps you . It seems you think schemas and roles are the same but they are not the same. Roles are security membership containers, a principal can be member of a role. Schemas contain database schema bound objects, they help to group database objects together, and are owned by a principal. When you create a new user you can choose his default schema, add him to certain roles, and grant him ownership of schemas.
Members of the db_denydatareader fixed database role cannot read any data in the user tables within a database.
DENY SELECT ON schema::[SchemaName] TO [user_name]
GRANT SELECT, UPDATE on SCHEMA::SchemaName TO [user_name]

Get access rights of specific folder for actual user


Tag : chash , By : firebasket
Date : March 29 2020, 07:55 AM
may help you . I hope you can help me. I need to obtain access rights (read, write etc.) of specific folder for actual user (which started the program) or for his group (users/administrators...) , If I got it right, you need something like this:
internal class Program
{
    private static void Main(string[] args)
    {
        string path = @"C:\Windows";
        Console.WriteLine($"{path} - {getRights(path)}");
        Console.ReadLine();
    }

    static string getRights(string path)
    {
        DirectoryInfo directoryInfo = new DirectoryInfo(path);
        if (!directoryInfo.Exists)
        {
            return "Directory doesn't exist";
        }
        FileSystemRights fsRights = 0;
        DirectorySecurity directorySecurity = directoryInfo.GetAccessControl();
        AuthorizationRuleCollection authRules = directorySecurity.GetAccessRules(true, true, typeof(NTAccount));
        WindowsIdentity currentUser = WindowsIdentity.GetCurrent();
        WindowsPrincipal principal = new WindowsPrincipal(currentUser);

        foreach (AuthorizationRule rule in authRules)
        {
            FileSystemAccessRule fsRule = rule as FileSystemAccessRule;

            if (fsRule != null)
            {
                NTAccount ntAccount = rule.IdentityReference as NTAccount;

                if (principal.IsInRole(ntAccount.Value))
                {
                    if (fsRule.FileSystemRights > fsRights)
                    {
                        fsRights = fsRule.FileSystemRights;
                    }
                }
            }
        }

        switch (fsRights)
        {
            case FileSystemRights.FullControl:
                return "Full Control";
            case FileSystemRights r when (r >= FileSystemRights.Write):
                return "Write";
            case FileSystemRights r when (r >= FileSystemRights.ReadData):
                return "Read";
            default:
                return "No rights";
        }
    }
}
public enum FileSystemRights
{
    ReadData = 1,
    ListDirectory = 1,
    WriteData = 2,
    CreateFiles = 2,
    AppendData = 4,
    CreateDirectories = 4,
    ReadExtendedAttributes = 8,
    WriteExtendedAttributes = 16,
    ExecuteFile = 32,
    Traverse = 32,
    DeleteSubdirectoriesAndFiles = 64,
    ReadAttributes = 128,
    WriteAttributes = 256,
    Write = 278,
    Delete = 65536,
    ReadPermissions = 131072,
    Read = 131209,
    ReadAndExecute = 131241,
    Modify = 197055,
    ChangePermissions = 262144,
    TakeOwnership = 524288,
    Synchronize = 1048576,
    FullControl = 2032127
}

how to check if specific user having access to a shared folder location using C#


Tag : chash , By : Jonathan Bernard
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Sending a file from my application (Indy/Delphi) to an ASP page and then onto another server (Amazon S3)
  • Need to send a pasting command from one program to another?
  • Delphi, read data from 3rd party data field
  • Delphi 7 inheritance
  • Looking for a good Delphi unicode string library
  • How can I create a context menu for a Delphi component?
  • How to access a Cassandra distributed database from Delphi
  • How to avoid the focus on Delphi application?
  • Emulate terminal services
  • A better way of converting Codepage-1251 in RTF to Unicode
  • How to pass multiple different records (not class due to delphi limitations) to a function?
  • Resize PNG image
  • Easiest way to find previous instance of an application
  • Difference between GetPixel and Canvas.Pixels in Delphi
  • Get Current Pixel value using Scanline in Delphi
  • Delphi: hook ToggleSwitch manual State change to avoid a Click call
  • TRttiContext GetTypes not finding my types
  • Can you change the span of a control at run time which was created at run time in TGridPanel
  • How variables are catched inside anonymous method?
  • change x-axis label in xy value plot
  • when run "printui.exe /s",it return error code 33 (error_lock_acess),how to fix it?
  • I keep getting a read error when copying stream data
  • How to let the IDE know that I use ancestor variable?
  • Why doesn't this code break (array of pointers to pointers of record)
  • How to check a BLE device still connected with Delphi 10.3
  • Send Perform Message with Record
  • Delphi Rio 10.3.2: remove file from a ZIP file
  • I want to encrypt TidBytes with AES
  • How to get correct number of logical processors
  • Convert variant of type (Dispatch)
  • Can't check if class has been created
  • Bind parent object's event to temporary child object's method
  • Compiler bug with overloaded function
  • Delphi marquee progress bar
  • DirectX/DirectCompute CreateBuffer failure with error 0x80070057 (E_INVALIDARG)
  • Delphi resizable form completely remove caption bar
  • Does delphi-orm support enumeration types?
  • Creating object instance triggers AV
  • Delphi XE2: How to make properties settable at design time?
  • DrawTextEx not working with DT_RIGHT and Arial font
  • How do you modify a Delphi Panel so Alignment := taRightJustify renders Caption with slight right margin?
  • How to get the main thread of a console app to be MTA?
  • Creating XML document with IXMLNodes
  • Where can I find Delphi┬┤s component editor for TPopupMenu and TMenuItem?
  • Usage for LiveBinding
  • d2007 set dependency to external program
  • How to generate a GUID version 1 in Delphi?
  • Delphi ActionMainMenuBar Category Position
  • Delphi FMX dcpcrypt wrong result on macOS 64-bit
  • Firemonkey Rotate Text
  • Is using AlignWithMargins when spacing between controls good option?
  • IBtransaction and Firebird for a multi-user program
  • Do Delphi IDEs have a project/grouproject's file count and line count functionality?
  • To check if a query returns more Fields than when you created it and defined its persistent fields
  • Access violation while trying to call a procedure from another Unit
  • Clearing all DataSet Bookmarks
  • Increment a value like 'CJana001' in delphi object pascal
  • How is TClientDataSet sending SQL statements on ApplyUpdates
  • Which is current correct indy and open ssl versions to use with delphi2007
  • Delphi Xe2: WH_KEYBOARD won't return left-right virtual key codes
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com