Changeset 59


Ignore:
Timestamp:
Feb 8, 2009, 11:28:04 PM (15 years ago)
Author:
gav
Message:

Lots of changes to setup Acegi, should be complete with all current pages secured.
Added CSS and PersonGroup? and PersonGroupType?.
Adjust BootStrap? to suite.
Add Home and Admin pages.

Location:
branches/TaskRewrite/src
Files:
35 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/TaskRewrite/src/grails-app/conf/BootStrap.groovy

    r58 r59  
    4646//                         name:"gnuMims").save()
    4747
     48        //Authority
     49        def authInstance
     50
     51        authInstance = new Authority(description:"Application Admin",
     52                                        authority:"ROLE_ADMIN")
     53        BootStrapSaveAndTest(authInstance)
     54
     55        authInstance = new Authority(description:"Application Admin",
     56                                        authority:"ROLE_USER")
     57        BootStrapSaveAndTest(authInstance)
    4858           
    4959        //Person
    50 //         def passwordEncoded = authenticateService.encodePassword("pass")
     60        def passwordEncoded = authenticateService.encodePassword("pass")
     61        def personInstance
    5162
    52         def personInstance = new Person(loginName:"admin",
     63        personInstance = new Person(loginName:"admin",
    5364                                    firstName:"Admin",
    5465                                    lastName:"Powers",
    55                                     password:authenticateService.encodePassword("pass"),
     66                                    password:passwordEncoded,
    5667                                    email:"admin@example.com")
    5768        BootStrapSaveAndTest(personInstance)
     69        personInstance.addToAuthorities(Authority.get(1))
     70        personInstance.addToAuthorities(Authority.get(2))
    5871
    59         //Role
    60         def authInstance = new Authority(description:"Application Admin",
    61                             authority:"ROLE_ADMIN")
    62             authInstance.addToPersons(personInstance)
    63             authInstance.save()
     72        personInstance = new Person(loginName:"user",
     73                                    firstName:"Demo",
     74                                    lastName:"Danza",
     75                                    password:passwordEncoded,
     76                                    email:"user@example.com")
     77        BootStrapSaveAndTest(personInstance)
     78        personInstance.addToAuthorities(Authority.get(2))
    6479
    65 //         new Person(username:"admin",
    66 //             userRealName:"Admin Powers",
    67 //             enabled:true,
    68 //             
    69 //         new Person(personGroup:PersonGroup.get(3),
    70 //             firstName:"Admin",
    71 //             lastName:"Powers",
    72 //             userId:"admin",
    73 //             password:"pass").save()
    74 //         new Person(personGroup:PersonGroup.get(1),
    75 //             firstName:"Demo",
    76 //             lastName:"Danza",
    77 //             userId:"user",
    78 //             password:"pass").save()
     80        personInstance = new Person(loginName:"craig",
     81                                    firstName:"Craig",
     82                                    lastName:"SuperTech",
     83                                    password:passwordEncoded,
     84                                    email:"user@example.com")
     85        BootStrapSaveAndTest(personInstance)
     86        personInstance.addToAuthorities(Authority.get(2))
    7987
     88        personInstance = new Person(loginName:"joe",
     89                                    firstName:"Joe",
     90                                    lastName:"Samples",
     91                                    password:passwordEncoded,
     92                                    email:"user@example.com")
     93        BootStrapSaveAndTest(personInstance)
     94        personInstance.addToAuthorities(Authority.get(2))
    8095
    81 //         new Person(personGroup:PersonGroup.get(1),
    82 //             firstName:"Craig",
    83 //             lastName:"SuperTech",
    84 //             userId:"craig",
    85 //             password:"pass").save()
    86 //         new Person(personGroup:PersonGroup.get(2),
    87 //             firstName:"Joe",
    88 //             lastName:"Samples",
    89 //             userId:"joe",
    90 //             password:"pass").save()
    91 //         new Person(personGroup:PersonGroup.get(1),
    92 //             firstName:"Production",
    93 //             lastName:"Mann",
    94 //             userId:"Mann",
    95 //             password:"pass").save()
     96        personInstance = new Person(loginName:"mann",
     97                                    firstName:"Production",
     98                                    lastName:"Mann",
     99                                    password:passwordEncoded,
     100                                    email:"user@example.com")
     101        BootStrapSaveAndTest(personInstance)
     102        personInstance.addToAuthorities(Authority.get(2))
     103
    96104               
    97105        //TaskGroup
  • branches/TaskRewrite/src/grails-app/controllers/AuthorityController.groovy

    r58 r59  
    1 
    2 
    3 
    4 /**
    5  * Authority Controller.
    6  */
     1@Secured(['ROLE_ADMIN'])
    72class AuthorityController {
    83
  • branches/TaskRewrite/src/grails-app/controllers/LoginController.groovy

    r58 r59  
    3838                }
    3939        }
     40
     41    def loggedOut = {
     42        flash['message'] = 'Successfully logged out'
     43        auth()
     44    }
    4045
    4146        /**
  • branches/TaskRewrite/src/grails-app/controllers/LogoutController.groovy

    r58 r59  
    99        def index = {
    1010                // TODO  put any pre-logout code here
    11                 redirect(uri: '/j_spring_security_logout')
     11       
     12                redirect(uri: '/j_spring_security_logout?logoutSuccessUrl=/login/loggedOut')
    1213        }
    1314}
  • branches/TaskRewrite/src/grails-app/controllers/PersonController.groovy

    r58 r59  
    55 * User controller.
    66 */
     7@Secured(['ROLE_ADMIN'])
    78class PersonController {
    89
  • branches/TaskRewrite/src/grails-app/domain/Person.groovy

    r58 r59  
    11class Person {
    22        static transients = ['pass']
    3         static hasMany = [authorities: Authority]
    4         static belongsTo = Authority
     3    static hasMany = [authorities: Authority,
     4                        personGroups: PersonGroup]
     5//                         modifications: Modification,
     6//                         entries: Entry,
     7//                         tasks: Task]
     8
     9    static belongsTo = [Authority, PersonGroup]
    510
    611        String loginName
     
    2530
    2631        static constraints = {
    27                 loginName(blank: false, unique: true)
     32                loginName(blank: false, unique: true)//minSize:7
    2833                firstName(blank: false)
    2934        lastName(blank: false)
    30                 password(blank: false)
     35                password(blank: false) //minSize:7
    3136        employeeID(blank: true, nullable:true)
    3237        }
  • branches/TaskRewrite/src/grails-app/views/layouts/main.gsp

    r56 r59  
    11<html>
    22    <head>
    3         <title><g:layoutTitle default="Grails" /></title>
     3        <title><g:layoutTitle default="gnuMims" /></title>
    44        <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'main.css')}" />
    5         <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'favicon.ico')}" type="image/x-icon" />
     5        <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'gnuMimsIcon.ico')}" type="image/x-icon" />
    66        <g:layoutHead />
    7         <g:javascript library="application" />                         
     7        <g:javascript library="application" />
    88    </head>
    99    <body>
     10    <div id="wrapper" style="height: 100%;">
     11    <div id="top">
     12    </div>
     13    <div id="content" align="center">
    1014        <div id="spinner" class="spinner" style="display:none;">
    11             <img src="${createLinkTo(dir:'images',file:'spinner.gif')}" alt="Spinner" />
     15            <img src="${createLinkTo(dir:'images',file:'spinner.png')}" alt="Spinner" />
    1216        </div> 
    13         <div class="logo"><img src="${createLinkTo(dir:'images',file:'grails_logo.jpg')}" alt="Grails" /></div>
    14         <g:layoutBody />               
     17        <!-- <div class="logo" style="text-align: center; width: 980px; height: 220px">
     18          <img src="${createLinkTo(dir:'images',file:'logo.png')}"
     19        alt="gnuMims" />
     20        <g:render template="/adminmenubar" />
     21
     22        </div> -->
     23        <div id="Header">
     24        </div>
     25        <div class="appControl">
     26            <g:render template="/adminmenubar" />
     27        </div>
     28        <!-- Body wrapper div for IE -->
     29        <div style="text-align: center; width: 980px">
     30            <g:layoutBody />
     31        </div>
     32    </div>
     33    <div id="bottom">
     34    </div>
     35    </div>
    1536    </body>     
    1637</html>
  • branches/TaskRewrite/src/web-app/css/main.css

    r55 r59  
    22    margin: 0;
    33    /*padding: 0; SELECT NOT DISPLAYED CORRECTLY IN FIREFOX */
     4
    45}
    56
     
    1314
    1415body {
     16    text-align: center;
     17    width: 980px
    1518    background: #fff;
    1619    color: #333;
    1720    font: 11px verdana, arial, helvetica, sans-serif;
     21    background: transparent url("../images/brushed_metal.png") repeat fixed center;
     22}
     23
     24#wrapper {
     25  margin: 0 auto;
     26  padding: 0;
     27  width: 1024px;
     28}
     29
     30#top {
     31  background: url("../images/topBg.png") no-repeat scroll center;
     32  width: 1020px;
     33  height: 44px;
     34}
     35
     36#content {
     37  padding: 0px 20px 20px;
     38  background: url("../images/Contentbg.png") repeat-y scroll center;
     39  width: 980px;
     40}
     41
     42#Header {
     43  background: transparent url("../images/logo.png") no-repeat scroll center;
     44  width: 980px;
     45  height: 160px;
    1846}
    1947
     
    2250    font-weight: bold;
    2351    text-decoration: none;
    24 } 
     52}
    2553
    2654h1 {
     
    2856    font-weight: normal;
    2957    font-size: 16px;
    30     margin: .8em 0 .3em 0;
     58    margin: 0 0 .3em 0;
    3159}
    3260
    3361ul {
    34     padding-left: 15px; 
     62    padding-left: 15px;
    3563}
    3664
     
    5684
    5785.body {
    58     float: left;
    59     margin: 0 15px 10px 15px;
     86    padding: 0px 20px 20px;
     87    background: url("../images/Contentbg.png") repeat-y scroll center;
     88    height: 100%;
     89}
     90
     91/* Login/out and Admin*/
     92
     93.appcontrol {
     94    text-align: right;
     95    padding: 5px 160px 5px 5px
     96}
     97
     98.appcontrolButton {
     99    font-size: 10px;
     100    padding: 5px 5px;
    60101}
    61102
     
    63104
    64105.nav {
    65     background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
    66     border: 1px solid #ccc;
    67     border-style: solid none solid none;       
    68     margin-top: 5px;
    69     padding: 7px 12px;
    70 }
     106    text-align: centre;
     107    background: url("../images/linkPanel_long.png") top no-repeat;
     108    /*border: 1px solid #ccc;
     109    border-style: solid none solid none;*/
     110    padding: 15px 0px 0px 0px;
     111    width: 980px;
     112    height: 40px;
     113}
     114
     115/*.nav a{
     116    background: url("../images/linkPanel.png") no-repeat top;
     117    display: inline-block;
     118    width: 140px;
     119    height: 40px;
     120    text-decoration: none;
     121}*/
    71122
    72123.menuButton {
     
    76127.menuButton a {
    77128    color: #333;
    78     padding: 4px 6px;
     129    padding: 14px 25px;
    79130}
    80131.menuButton a.home {
    81     background: url(../images/skin/house.png) center left no-repeat;
    82     color: #333;
    83     padding-left: 25px;
     132    /*background: url(../images/skin/house.png) center left no-repeat;*/
     133    color: #333;
     134    /*padding: 25px;*/
    84135}
    85136.menuButton a.list {
    86     background: url(../images/skin/database_table.png) center left no-repeat;
    87     color: #333;
    88     padding-left: 25px;
     137    /*background: url(../images/skin/database_table.png) center left no-repeat;*/
     138    color: #333;
     139    /*padding-left: 25px;*/
    89140}
    90141.menuButton a.create {
    91     background: url(../images/skin/database_add.png) center left no-repeat;
    92     color: #333;
    93     padding-left: 25px;
     142    /*background: url(../images/skin/database_add.png) center left no-repeat;*/
     143    color: #333;
     144    /*padding-left: 25px;*/
    94145}
    95146
     
    101152    color: #006dba;
    102153    margin: 10px 0 5px 0;
    103     padding: 5px 5px 5px 30px
     154    padding: 5px 5px 5px 0px
    104155}
    105156
     
    113164div.errors ul {
    114165    list-style: none;
    115     padding: 0; 
     166    padding: 0;
    116167}
    117168div.errors li {
     
    137188    border: 0;
    138189}
    139 td, th { 
     190td, th {
    140191    font: 11px verdana, arial, helvetica, sans-serif;
    141192    line-height: 12px;
     
    266317    padding-left: 28px;
    267318}
     319
     320#bottom {
     321  background: url("../images/bottomBg.png") no-repeat scroll center;
     322  width: 1020px;
     323  height: 100px;
     324}
  • branches/TaskRewrite/src/web-app/index.gsp

    r54 r59  
    1 <html>
    2     <head>
    3         <title>Welcome to Grails</title>
    4                 <meta name="layout" content="main" />
    5     </head>
    6     <body>
    7         <h1 style="margin-left:20px;">Welcome to Grails</h1>
    8         <p style="margin-left:20px;width:80%">Congratulations, you have successfully started your first Grails application! At the moment
    9         this is the default page, feel free to modify it to either redirect to a controller or display whatever
    10         content you may choose. Below is a list of controllers that are currently deployed in this application,
    11         click on each to execute its default action:</p>
    12         <div class="dialog" style="margin-left:20px;width:60%;">
    13             <ul>
    14               <g:each var="c" in="${grailsApplication.controllerClasses}">
    15                     <li class="controller"><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li>
    16               </g:each>
    17             </ul>
    18         </div>
    19     </body>
    20 </html>
     1<%response.sendRedirect(request.getContextPath()+'/appCore/home')%>
Note: See TracChangeset for help on using the changeset viewer.